.NET: Fix classpath and IGNITE_HOME debug logging
authorPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 23 Nov 2017 16:47:02 +0000 (19:47 +0300)
committerPavel Tupitsyn <ptupitsyn@apache.org>
Thu, 23 Nov 2017 16:47:02 +0000 (19:47 +0300)
modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs
modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs

index 4542eaa..e80bd3f 100644 (file)
@@ -75,9 +75,17 @@ namespace Apache.Ignite.Core.Tests.Log
 
             // Test that all levels are present
             foreach (var level in AllLevels.Where(x => x != LogLevel.Error))
+            {
                 Assert.IsTrue(TestLogger.Entries.Any(x => x.Level == level), "No messages with level " + level);
-        }
+            }
 
+            // Check IgniteHome and classpath messages.
+            Assert.IsTrue(TestLogger.Entries.Any(x => x.Level == LogLevel.Debug &&
+                                                      x.Message == "Classpath resolved to: {0}"));
+            
+            Assert.IsTrue(TestLogger.Entries.Any(x => x.Level == LogLevel.Debug &&
+                                                      x.Message == "IGNITE_HOME resolved to: {0}"));
+        }
 
         /// <summary>
         /// Tests startup error in Java.
index 86e70a6..d373933 100644 (file)
@@ -68,7 +68,9 @@ namespace Apache.Ignite.Core.Impl.Common
                 AppendHomeClasspath(ggHome, forceTestClasspath, cpStr);
 
             if (log != null)
-                log.Debug("Classpath resolved to: " + cpStr);
+            {
+                log.Debug("Classpath resolved to: {0}", cpStr);
+            }
 
             var res = cpStr.ToString();
             res = res.StartsWith(ClasspathPrefix) ? res : ClasspathPrefix + res;
index 47065bc..341dba0 100644 (file)
@@ -57,7 +57,9 @@ namespace Apache.Ignite.Core.Impl.Common
                 throw new IgniteException(string.Format("{0} is not valid: '{1}'", EnvIgniteHome, home));
 
             if (log != null)
-                log.Debug("IgniteHome resolved to '{0}'", home);
+            {
+                log.Debug("IGNITE_HOME resolved to: {0}", home);
+            }
 
             return home;
         }
index fd9fb79..ce84003 100644 (file)
@@ -74,7 +74,7 @@ namespace Apache.Ignite.Core.Impl
                 }
 
                 // 2. Create unmanaged pointer.
-                var jvm = CreateJvm(cfg);
+                var jvm = CreateJvm(cfg, log);
 
                 if (cfg.RedirectJavaConsoleOutput)
                 {
@@ -106,9 +106,9 @@ namespace Apache.Ignite.Core.Impl
         /// Create JVM.
         /// </summary>
         /// <returns>JVM.</returns>
-        private static Jvm CreateJvm(IgniteConfiguration cfg)
+        private static Jvm CreateJvm(IgniteConfiguration cfg, ILogger log)
         {
-            var cp = Classpath.CreateClasspath(cfg);
+            var cp = Classpath.CreateClasspath(cfg, log: log);
 
             var jvmOpts = GetMergedJvmOptions(cfg);