From 165beb3fbd79ff06d0ded92d27aa825a76b6bd15 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 27 Jul 2019 11:32:38 +0000
Subject: [PATCH] TCG: split config log tweaks and cleanups Fix warning about
 no tunnels loaded Add notes in config default files

---
 .../net/i2p/i2ptunnel/TunnelControllerGroup.java   | 14 ++++++++------
 installer/resources/clients.config                 |  4 ++++
 installer/resources/i2ptunnel.config               |  4 ++++
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java
index d4078a16b6..712d16ee07 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/TunnelControllerGroup.java
@@ -359,6 +359,9 @@ public class TunnelControllerGroup implements ClientApp {
                     boolean ok = migrate(props, cfgFile, dir);
                     if (!ok)
                         shouldMigrate = false;
+                } else {
+                    _log.logAlways(Log.WARN, "Using new tunnel configurations in " + dir +
+                                             " - ignoring old tunnel configuration in " + cfgFile);
                 }
             } catch (IOException ioe) {
                 if (_log.shouldLog(Log.ERROR))
@@ -368,7 +371,6 @@ public class TunnelControllerGroup implements ClientApp {
         } else if (!shouldMigrate) {
                 throw new IllegalArgumentException("Unable to load the controllers from " + cfgFile);
         }
-        int i = 0;
         _controllersLock.writeLock().lock();
         try {
             if (shouldMigrate && dir.isDirectory()) {
@@ -401,7 +403,6 @@ public class TunnelControllerGroup implements ClientApp {
                         continue;
                     TunnelController controller = new TunnelController(cfg, "");
                     _controllers.add(controller);
-                    i++;
                 }
             }
         } finally {
@@ -409,6 +410,7 @@ public class TunnelControllerGroup implements ClientApp {
         }
 
         _controllersLoaded = true;
+        int i = _controllers.size();
         if (i > 0) {
             if (_log.shouldLog(Log.INFO))
                 _log.info(i + " controllers loaded from " + cfgFile);
@@ -849,12 +851,12 @@ public class TunnelControllerGroup implements ClientApp {
         DataHelper.loadProps(config, cfgFile);
         for (String key : config.stringPropertyNames()) {
             if (key.startsWith(PREFIX)) {
-                if (_log.shouldLog(Log.WARN))
-                    _log.warn("Found monolithic config file " +key+ cfgFile.toString());
+                if (_log.shouldDebug())
+                    _log.debug("Found monolithic config file " + cfgFile);
                 return loadMonolithicConfig(config, cfgFile.getAbsolutePath());
             } else {
-                if (_log.shouldLog(Log.WARN))
-                    _log.warn("Found split config file " +key+ cfgFile.toString());
+                if (_log.shouldDebug())
+                    _log.debug("Found split config file " + cfgFile);
                 List<Properties> rv = new ArrayList<Properties>(1);
                 config.setProperty(TunnelController.PROP_CONFIG_FILE, cfgFile.getAbsolutePath());
                 rv.add(config);
diff --git a/installer/resources/clients.config b/installer/resources/clients.config
index 296929b984..e60d7f0e0e 100644
--- a/installer/resources/clients.config
+++ b/installer/resources/clients.config
@@ -9,6 +9,10 @@
 # When running as a Windows service, the configuration directory is \ProgramData\i2p
 # and the install directory is \Program Files\i2p .
 #
+# On first run, this file will be split into individual config files
+# in clients.config.d/ in the configuration directory.
+# Look in that directory for the file to edit.
+#
 
 # fire up the web console
 ## There are several choices, here are some examples:
diff --git a/installer/resources/i2ptunnel.config b/installer/resources/i2ptunnel.config
index 8449b71832..24b29954bf 100644
--- a/installer/resources/i2ptunnel.config
+++ b/installer/resources/i2ptunnel.config
@@ -9,6 +9,10 @@
 # When running as a Windows service, the configuration directory is \ProgramData\i2p
 # and the install directory is \Program Files\i2p .
 #
+# On first run, this file will be split into individual config files
+# in i2ptunnel.config.d/ in the configuration directory.
+# Look in that directory for the file to edit.
+#
 
 # eepproxy
 tunnel.0.name=I2P HTTP Proxy
-- 
GitLab