From 3b4d7eebc7d6efe40efc19c3b9e3d7af19957544 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Fri, 15 Jun 2018 16:06:01 +0200 Subject: [PATCH] Disable geth.log in release builds. Fixes #4782 Signed-off-by: Pedro Pombeiro --- .env.prod | 2 +- .../main/java/im/status/ethereum/module/StatusModule.java | 6 +++--- modules/react-native-status/ios/RCTStatus/RCTStatus.m | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.prod b/.env.prod index 294b4f79d3..eabdf0fa1a 100644 --- a/.env.prod +++ b/.env.prod @@ -5,7 +5,7 @@ MAINNET_WARNING_ENABLED=1 OFFLINE_INBOX_ENABLED=1 RPC_NETWORKS_ONLY=1 LOG_LEVEL=info -LOG_LEVEL_STATUS_GO=info +LOG_LEVEL_STATUS_GO= QUEUE_MESSAGE_ENABLED=0 RN_BRIDGE_THRESHOLD_WARNINGS=0 POW_TARGET=0.002 diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java index 594a3f7032..b102400516 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java @@ -216,10 +216,10 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL JSONObject jsonConfig = new JSONObject(config); - String gethLogFilePath = prepareLogsFile(); - boolean logsEnabled = (gethLogFilePath != null) && !TextUtils.isEmpty(this.logLevel); + String gethLogFilePath = TextUtils.isEmpty(this.logLevel) ? null : prepareLogsFile(); + boolean logsEnabled = (gethLogFilePath != null); - jsonConfig.put("LogEnabled", (gethLogFilePath != null && logsEnabled)); + jsonConfig.put("LogEnabled", logsEnabled); jsonConfig.put("LogFile", gethLogFilePath); jsonConfig.put("LogLevel", TextUtils.isEmpty(this.logLevel) ? "ERROR" : this.logLevel.toUpperCase()); jsonConfig.put("DataDir", dataDir); diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 8e2203fa22..81ac636637 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -179,7 +179,7 @@ RCT_EXPORT_METHOD(startNode:(NSString *)configString) { NSURL *logUrl = [networkDirUrl URLByAppendingPathComponent:@"geth.log"]; [resultingConfigJson setValue:newKeystoreUrl.path forKey:@"KeyStoreDir"]; [resultingConfigJson setValue:[NSNumber numberWithBool:[logLevel length] != 0] forKey:@"LogEnabled"]; - [resultingConfigJson setValue:logUrl.path forKey:@"LogFile"]; + [resultingConfigJson setValue:([logLevel length] == 0 ? [NSNull null] : logUrl.path) forKey:@"LogFile"]; [resultingConfigJson setValue:([logLevel length] == 0 ? [NSString stringWithUTF8String: "ERROR"] : logLevel) forKey:@"LogLevel"]; [resultingConfigJson setValue:[NSNumber numberWithBool:YES] forKeyPath:@"WhisperConfig.LightClient"];