ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [28/50] [abbrv] ignite git commit: Log4j2LoggerSelfTest.testLogFilesTwoNodes test case for Windows.
Date Fri, 04 Sep 2015 10:37:10 GMT
Log4j2LoggerSelfTest.testLogFilesTwoNodes test case for Windows.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8901575e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8901575e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8901575e

Branch: refs/heads/ignite-843
Commit: 8901575e14f7334874d630ae685db624d00dcc7f
Parents: 154f185
Author: Artem Shutak <artem.shutak@gmail.com>
Authored: Thu Sep 3 18:57:47 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu Sep 3 18:57:47 2015 +0300

----------------------------------------------------------------------
 .../ignite/logger/log4j2/Log4J2Logger.java      | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8901575e/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
index 5e6ab34..ffe8e1b 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -242,10 +242,10 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware
{
                             Appender innerApp = control.getAppender();
 
                             if (innerApp instanceof FileAppender)
-                                return ((FileAppender)innerApp).getFileName();
+                                return normilize(((FileAppender)innerApp).getFileName());
 
                             if (innerApp instanceof RollingFileAppender)
-                                return ((RollingFileAppender)innerApp).getFileName();
+                                return normilize(((RollingFileAppender)innerApp).getFileName());
                         }
                     }
                     catch (IllegalAccessException | NoSuchFieldException e) {
@@ -259,6 +259,20 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware
{
     }
 
     /**
+     * Normalizes given path for windows.
+     * Log4j2 doesn't replace unix directory delimiters which used at 'fileName' to windows.
+     *
+     * @param path Path.
+     * @return Normalized path.
+     */
+    private String normilize(String path) {
+        if (!U.isWindows())
+            return path;
+
+        return path.replace('/', File.separatorChar);
+    }
+
+    /**
      * Adds console appender when needed with some default logging settings.
      *
      * @param initLogClo Optional log implementation init closure.
@@ -495,4 +509,4 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
     @Override public String toString() {
         return S.toString(Log4J2Logger.class, this);
     }
-}
\ No newline at end of file
+}


Mime
View raw message