Skip to content

Commit f863ca0

Browse files
committed
.NET: Fix classpath and IGNITE_HOME debug logging
1 parent f3cc3df commit f863ca0

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,17 @@ public void TestStartupOutput()
7575

7676
// Test that all levels are present
7777
foreach (var level in AllLevels.Where(x => x != LogLevel.Error))
78+
{
7879
Assert.IsTrue(TestLogger.Entries.Any(x => x.Level == level), "No messages with level " + level);
79-
}
80+
}
8081

82+
// Check IgniteHome and classpath messages.
83+
Assert.IsTrue(TestLogger.Entries.Any(x => x.Level == LogLevel.Debug &&
84+
x.Message == "Classpath resolved to: {0}"));
85+
86+
Assert.IsTrue(TestLogger.Entries.Any(x => x.Level == LogLevel.Debug &&
87+
x.Message == "IGNITE_HOME resolved to: {0}"));
88+
}
8189

8290
/// <summary>
8391
/// Tests startup error in Java.

modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ internal static string CreateClasspath(IgniteConfiguration cfg = null, bool forc
6868
AppendHomeClasspath(ggHome, forceTestClasspath, cpStr);
6969

7070
if (log != null)
71-
log.Debug("Classpath resolved to: " + cpStr);
71+
{
72+
log.Debug("Classpath resolved to: {0}", cpStr);
73+
}
7274

7375
var res = cpStr.ToString();
7476
res = res.StartsWith(ClasspathPrefix) ? res : ClasspathPrefix + res;

modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public static string Resolve(IgniteConfiguration cfg, ILogger log = null)
5757
throw new IgniteException(string.Format("{0} is not valid: '{1}'", EnvIgniteHome, home));
5858

5959
if (log != null)
60-
log.Debug("IgniteHome resolved to '{0}'", home);
60+
{
61+
log.Debug("IGNITE_HOME resolved to: {0}", home);
62+
}
6163

6264
return home;
6365
}

modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ internal static UnmanagedCallbacks CreateJvmContext(IgniteConfiguration cfg, ILo
7474
}
7575

7676
// 2. Create unmanaged pointer.
77-
var jvm = CreateJvm(cfg);
77+
var jvm = CreateJvm(cfg, log);
7878

7979
if (cfg.RedirectJavaConsoleOutput)
8080
{
@@ -106,9 +106,9 @@ internal static PlatformMemoryManager Memory
106106
/// Create JVM.
107107
/// </summary>
108108
/// <returns>JVM.</returns>
109-
private static Jvm CreateJvm(IgniteConfiguration cfg)
109+
private static Jvm CreateJvm(IgniteConfiguration cfg, ILogger log)
110110
{
111-
var cp = Classpath.CreateClasspath(cfg);
111+
var cp = Classpath.CreateClasspath(cfg, log: log);
112112

113113
var jvmOpts = GetMergedJvmOptions(cfg);
114114

0 commit comments

Comments
 (0)