From 53fa2800375652865d470c4556874ee2f06fddf5 Mon Sep 17 00:00:00 2001 From: albexk Date: Fri, 5 Jul 2024 18:42:53 +0300 Subject: [PATCH] Fix logging configuration for XRay --- client/android/xray/src/main/kotlin/Xray.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/client/android/xray/src/main/kotlin/Xray.kt b/client/android/xray/src/main/kotlin/Xray.kt index b4d0b51f..7d16d3a0 100644 --- a/client/android/xray/src/main/kotlin/Xray.kt +++ b/client/android/xray/src/main/kotlin/Xray.kt @@ -117,14 +117,9 @@ class Xray : Protocol() { val xrayJsonConfig = config.getJSONObject("xray_config_data") val xrayConfig = parseConfig(config, xrayJsonConfig) - // for debug - // xrayJsonConfig.getJSONObject("log").put("loglevel", "debug") - xrayJsonConfig.getJSONObject("log").put("loglevel", "warning") - // disable access log - xrayJsonConfig.getJSONObject("log").put("access", "none") - - // replace socks address - // (xrayJsonConfig.getJSONArray("inbounds")[0] as JSONObject).put("listen", "::1") + (xrayJsonConfig.optJSONObject("log") ?: JSONObject().also { xrayJsonConfig.put("log", it) }) + .put("loglevel", "warning") + .put("access", "none") // disable access log start(xrayConfig, xrayJsonConfig.toString(), vpnBuilder, protect) state.value = CONNECTED