.NET: Fix classpath and IGNITE_HOME debug logging
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f863ca01 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f863ca01 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f863ca01 Branch: refs/heads/ignite-zk Commit: f863ca016707e51ab3615c598b40e01355c1a12d Parents: f3cc3df Author: Pavel Tupitsyn <ptupit...@apache.org> Authored: Thu Nov 23 19:47:02 2017 +0300 Committer: Pavel Tupitsyn <ptupit...@apache.org> Committed: Thu Nov 23 19:47:02 2017 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs | 10 +++++++++- .../dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs | 4 +++- .../dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs | 4 +++- .../dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs | 6 +++--- 4 files changed, 18 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/f863ca01/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs index 4542eaa..e80bd3f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs @@ -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. http://git-wip-us.apache.org/repos/asf/ignite/blob/f863ca01/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs index 86e70a6..d373933 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs @@ -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; http://git-wip-us.apache.org/repos/asf/ignite/blob/f863ca01/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs index 47065bc..341dba0 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs @@ -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; } http://git-wip-us.apache.org/repos/asf/ignite/blob/f863ca01/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs index fd9fb79..ce84003 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs @@ -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);