You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2019/04/26 16:57:03 UTC

[ignite] branch ignite-dotnet-linux-fail-test updated: Add more info to the output

This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch ignite-dotnet-linux-fail-test
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-dotnet-linux-fail-test by this push:
     new 5e929e8  Add more info to the output
5e929e8 is described below

commit 5e929e8d7dbafc203db375077f63b99c108d9496
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Fri Apr 26 19:56:50 2019 +0300

    Add more info to the output
---
 .../Impl/Unmanaged/Jni/ConsoleWriter.cs             | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/ConsoleWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/ConsoleWriter.cs
index 7d09301..c30f849 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/ConsoleWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/Jni/ConsoleWriter.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Unmanaged.Jni
 {
     using System.Diagnostics.CodeAnalysis;
     using System.Globalization;
+    using System.IO;
 
     /// <summary>
     /// Console writer.
@@ -43,11 +44,22 @@ namespace Apache.Ignite.Core.Impl.Unmanaged.Jni
 
         /** Flag: whether to suppress stderr warnings from Java 11. */
         private readonly bool _suppressIllegalAccessWarnings;
+        private readonly StreamWriter _file;
 
         public ConsoleWriter()
         {
-            Console.WriteLine("ConsoleWriter Initialized.");
-            Console.WriteLine("CULTURE: " + CultureInfo.CurrentCulture.Name);
+            var binDir = Path.GetDirectoryName(GetType().Assembly.Location);
+            var file = Path.Combine(binDir, "dotnet-test.log");
+
+            if (File.Exists(file))
+            {
+                File.Delete(file);
+            }
+
+            _file = File.AppendText(file);
+
+            _file.WriteLine("ConsoleWriter Initialized.");
+            _file.WriteLine("CULTURE: " + CultureInfo.CurrentCulture.Name);
 
             _suppressIllegalAccessWarnings =
                 Environment.GetEnvironmentVariable(EnvIgniteNetSuppressJavaIllegalAccessWarnings) == "true";
@@ -66,7 +78,10 @@ namespace Apache.Ignite.Core.Impl.Unmanaged.Jni
                 message = string.Format("|ERR-{0}-{1}|: {2}", IsKnownWarning(message), _suppressIllegalAccessWarnings, message);
             }
 
-            Console.Out.Write(message);
+            lock (_file)
+            {
+                _file.Write(message);
+            }
         }
 
         /** <inheritdoc /> */