ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [10/53] [abbrv] incubator-ignite git commit: # gg-9470-rename
Date Thu, 04 Dec 2014 23:24:02 GMT
# gg-9470-rename


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

Branch: refs/heads/master
Commit: ff14819bc45b99c1f5c466a43941b03138d3d1b9
Parents: ee5e27b
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Dec 4 21:47:48 2014 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Dec 4 21:47:48 2014 +0300

----------------------------------------------------------------------
 .../singlesplit/GridSingleSplitsLoadTest.java   |   2 +-
 .../gridify/GridifySingleSplitLoadTest.java     |   2 +-
 .../router/GridTcpRouterAbstractSelfTest.java   |   2 +-
 .../router/GridTcpRouterMultiNodeSelfTest.java  |   2 +-
 .../src/test/resources/spring-router-ssl.xml    |   2 +-
 .../src/test/resources/spring-router.xml        |   2 +-
 .../src/test/resources/spring-server-node.xml   |   2 +-
 .../test/resources/spring-server-ssl-node.xml   |   2 +-
 .../child/GridHadoopExternalProcessStarter.java |   6 +-
 .../GridLog4jDailyRollingFileAppender.java      |  69 ---
 .../GridLog4jExternallyRolledFileAppender.java  |  55 --
 .../logger/log4j/GridLog4jFileAppender.java     |  99 ----
 .../ignite/logger/log4j/GridLog4jFileAware.java |  24 -
 .../ignite/logger/log4j/GridLog4jLogger.java    | 516 -------------------
 .../logger/log4j/GridLog4jNodeIdFilePath.java   |  56 --
 .../log4j/GridLog4jRollingFileAppender.java     |  82 ---
 .../IgniteLog4jDailyRollingFileAppender.java    |  69 +++
 ...IgniteLog4jExternallyRolledFileAppender.java |  55 ++
 .../logger/log4j/IgniteLog4jFileAppender.java   |  99 ++++
 .../logger/log4j/IgniteLog4jFileAware.java      |  24 +
 .../ignite/logger/log4j/IgniteLog4jLogger.java  | 516 +++++++++++++++++++
 .../logger/log4j/IgniteLog4jNodeIdFilePath.java |  56 ++
 .../log4j/IgniteLog4jRollingFileAppender.java   |  82 +++
 .../log4j/GridLog4jCorrectFileNameTest.java     |  16 +-
 .../logger/log4j/GridLog4jInitializedTest.java  |   4 +-
 .../logger/log4j/GridLog4jLoggingFileTest.java  |   2 +-
 .../logger/log4j/GridLog4jLoggingPathTest.java  |   2 +-
 .../logger/log4j/GridLog4jLoggingUrlTest.java   |   2 +-
 .../log4j/GridLog4jNotInitializedTest.java      |   2 +-
 29 files changed, 926 insertions(+), 926 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java b/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java
index 75fce32..f2594f2 100644
--- a/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java
+++ b/modules/aop/src/test/java/org/gridgain/loadtests/direct/singlesplit/GridSingleSplitsLoadTest.java
@@ -43,7 +43,7 @@ public class GridSingleSplitsLoadTest extends GridCommonAbstractTest {
         cfg.setCommunicationSpi(new GridTcpCommunicationSpi());
         cfg.setDiscoverySpi(new GridTcpDiscoverySpi());
 
-        GridLog4jLogger log = (GridLog4jLogger)cfg.getGridLogger().getLogger(null);
+        IgniteLog4jLogger log = (IgniteLog4jLogger)cfg.getGridLogger().getLogger(null);
 
         log.setLevel(Level.INFO);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java b/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java
index 5c53ebb..fdfc09f 100644
--- a/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java
+++ b/modules/aop/src/test/java/org/gridgain/loadtests/gridify/GridifySingleSplitLoadTest.java
@@ -60,7 +60,7 @@ public class GridifySingleSplitLoadTest extends GridCommonAbstractTest {
         /*
          */
         @SuppressWarnings("TypeMayBeWeakened")
-        GridLog4jLogger log = (GridLog4jLogger)cfg.getGridLogger();
+        IgniteLog4jLogger log = (IgniteLog4jLogger)cfg.getGridLogger();
 
         log.getLogger("org.gridgain.grid").setLevel(Level.INFO);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterAbstractSelfTest.java b/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterAbstractSelfTest.java
index 76aaac0..ae8784e 100644
--- a/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterAbstractSelfTest.java
@@ -99,7 +99,7 @@ public abstract class GridTcpRouterAbstractSelfTest extends GridClientAbstractSe
         cfg.setPort(ROUTER_PORT);
         cfg.setPortRange(0);
         cfg.setServers(Collections.singleton(HOST+":"+BINARY_PORT));
-        cfg.setLogger(new GridLog4jLogger(ROUTER_LOG_CFG));
+        cfg.setLogger(new IgniteLog4jLogger(ROUTER_LOG_CFG));
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterMultiNodeSelfTest.java b/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterMultiNodeSelfTest.java
index e71dc0b..0fc4764 100644
--- a/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterMultiNodeSelfTest.java
+++ b/modules/clients/src/test/java/org/gridgain/client/router/GridTcpRouterMultiNodeSelfTest.java
@@ -70,7 +70,7 @@ public class GridTcpRouterMultiNodeSelfTest extends GridClientAbstractMultiNodeS
         cfg.setPort(ROUTER_TCP_PORT_BASE + i);
         cfg.setPortRange(0);
         cfg.setServers(Collections.singleton(HOST + ":" + REST_TCP_PORT_BASE));
-        cfg.setLogger(new GridLog4jLogger(ROUTER_LOG_CFG));
+        cfg.setLogger(new IgniteLog4jLogger(ROUTER_LOG_CFG));
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/clients/src/test/resources/spring-router-ssl.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-router-ssl.xml b/modules/clients/src/test/resources/spring-router-ssl.xml
index fd10411..06ecf69 100644
--- a/modules/clients/src/test/resources/spring-router-ssl.xml
+++ b/modules/clients/src/test/resources/spring-router-ssl.xml
@@ -92,7 +92,7 @@
     <!--
         Logger with the same configuration as in default grid instances.
     -->
-    <bean id="router.log" class="org.apache.ignite.logger.log4j.GridLog4jLogger">
+    <bean id="router.log" class="org.apache.ignite.logger.log4j.IgniteLog4jLogger">
         <constructor-arg type="java.lang.String" value="modules/clients/src/test/resources/log4j.xml"/>
     </bean>
 </beans>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/clients/src/test/resources/spring-router.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-router.xml b/modules/clients/src/test/resources/spring-router.xml
index 671ade5..48b883e 100644
--- a/modules/clients/src/test/resources/spring-router.xml
+++ b/modules/clients/src/test/resources/spring-router.xml
@@ -81,7 +81,7 @@
     <!--
         Logger with the same configuration as in default grid instances.
     -->
-    <bean id="router.log" class="org.apache.ignite.logger.log4j.GridLog4jLogger">
+    <bean id="router.log" class="org.apache.ignite.logger.log4j.IgniteLog4jLogger">
         <constructor-arg type="java.lang.String" value="modules/clients/src/test/resources/log4j.xml"/>
     </bean>
 </beans>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/clients/src/test/resources/spring-server-node.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-server-node.xml b/modules/clients/src/test/resources/spring-server-node.xml
index 0068277..c5d9e8a 100644
--- a/modules/clients/src/test/resources/spring-server-node.xml
+++ b/modules/clients/src/test/resources/spring-server-node.xml
@@ -309,7 +309,7 @@
             Logger to use.
         -->
         <property name="gridLogger">
-            <bean class="org.apache.ignite.logger.log4j.GridLog4jLogger">
+            <bean class="org.apache.ignite.logger.log4j.IgniteLog4jLogger">
                 <constructor-arg type="java.lang.String" value="modules/clients/src/test/resources/log4j.xml"/>
             </bean>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/clients/src/test/resources/spring-server-ssl-node.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-server-ssl-node.xml b/modules/clients/src/test/resources/spring-server-ssl-node.xml
index c2255b4..27eb154 100644
--- a/modules/clients/src/test/resources/spring-server-ssl-node.xml
+++ b/modules/clients/src/test/resources/spring-server-ssl-node.xml
@@ -276,7 +276,7 @@
             Logger to use.
         -->
         <property name="gridLogger">
-            <bean class="org.apache.ignite.logger.log4j.GridLog4jLogger">
+            <bean class="org.apache.ignite.logger.log4j.IgniteLog4jLogger">
                 <constructor-arg type="java.lang.String" value="modules/clients/src/test/resources/log4j.xml"/>
             </bean>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/taskexecutor/external/child/GridHadoopExternalProcessStarter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/taskexecutor/external/child/GridHadoopExternalProcessStarter.java b/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/taskexecutor/external/child/GridHadoopExternalProcessStarter.java
index d6bf914..6b0e098 100644
--- a/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/taskexecutor/external/child/GridHadoopExternalProcessStarter.java
+++ b/modules/hadoop/src/main/java/org/gridgain/grid/kernal/processors/hadoop/taskexecutor/external/child/GridHadoopExternalProcessStarter.java
@@ -142,17 +142,17 @@ public class GridHadoopExternalProcessStarter {
     private IgniteLogger logger(final File outputDir) {
         final URL url = U.resolveGridGainUrl(DFLT_LOG4J_CONFIG);
 
-        GridLog4jLogger logger;
+        IgniteLog4jLogger logger;
 
         try {
-            logger = url != null ? new GridLog4jLogger(url) : new GridLog4jLogger(true);
+            logger = url != null ? new IgniteLog4jLogger(url) : new IgniteLog4jLogger(true);
         }
         catch (GridException e) {
             System.err.println("Failed to create URL-based logger. Will use default one.");
 
             e.printStackTrace();
 
-            logger = new GridLog4jLogger(true);
+            logger = new IgniteLog4jLogger(true);
         }
 
         logger.updateFilePath(new IgniteClosure<String, String>() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jDailyRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jDailyRollingFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jDailyRollingFileAppender.java
deleted file mode 100644
index 39722f0..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jDailyRollingFileAppender.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.logger.log4j;
-
-import org.apache.ignite.lang.*;
-import org.apache.log4j.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link DailyRollingFileAppender} with added support for grid node IDs.
- */
-public class GridLog4jDailyRollingFileAppender extends DailyRollingFileAppender implements GridLog4jFileAware {
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public GridLog4jDailyRollingFileAppender() {
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param datePtrn Date pattern.
-     * @throws IOException If failed.
-     */
-    public GridLog4jDailyRollingFileAppender(Layout layout, String filename, String datePtrn) throws IOException {
-        super(layout, filename, datePtrn);
-
-        init();
-    }
-
-    /**
-     *
-     */
-    private void init() {
-        GridLog4jLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jExternallyRolledFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jExternallyRolledFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jExternallyRolledFileAppender.java
deleted file mode 100644
index 95d7da9..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jExternallyRolledFileAppender.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.logger.log4j;
-
-import org.apache.ignite.lang.*;
-import org.apache.log4j.varia.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link ExternallyRolledFileAppender} with added support for grid node IDs.
- */
-public class GridLog4jExternallyRolledFileAppender extends ExternallyRolledFileAppender implements GridLog4jFileAware {
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public GridLog4jExternallyRolledFileAppender() {
-        init();
-    }
-
-    /**
-     *
-     */
-    private void init() {
-        GridLog4jLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAppender.java
deleted file mode 100644
index f6a0aba..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAppender.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.logger.log4j;
-
-import org.apache.ignite.lang.*;
-import org.apache.log4j.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link FileAppender} with added support for grid node IDs.
- */
-public class GridLog4jFileAppender extends FileAppender implements GridLog4jFileAware {
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public GridLog4jFileAppender() {
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @throws IOException If failed.
-     */
-    public GridLog4jFileAppender(Layout layout, String filename) throws IOException {
-        super(layout, filename);
-
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param append Append flag.
-     * @throws IOException If failed.
-     */
-    public GridLog4jFileAppender(Layout layout, String filename, boolean append) throws IOException {
-        super(layout, filename, append);
-
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param append Append flag.
-     * @param bufIO Buffered IO flag.
-     * @param bufSize Buffer size.
-     * @throws IOException If failed.
-     */
-    public GridLog4jFileAppender(Layout layout, String filename, boolean append, boolean bufIO, int bufSize)
-        throws IOException {
-        super(layout, filename, append, bufIO, bufSize);
-
-        init();
-    }
-
-    /**
-     *
-     */
-    private void init() {
-        GridLog4jLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAware.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAware.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAware.java
deleted file mode 100644
index 4e9dc4c..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jFileAware.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.logger.log4j;
-
-import org.apache.ignite.lang.*;
-
-/**
- * Interface for those loggers and appenders that evaluate their file paths lazily.
- */
-interface GridLog4jFileAware {
-    /**
-     * Sets closure that later evaluate file path.
-     *
-     * @param filePathClos Closure that generates actual file path.
-     */
-    void updateFilePath(IgniteClosure<String, String> filePathClos);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jLogger.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jLogger.java
deleted file mode 100644
index 56e7e05..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jLogger.java
+++ /dev/null
@@ -1,516 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.logger.log4j;
-
-import org.apache.ignite.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.logger.*;
-import org.apache.log4j.*;
-import org.apache.log4j.varia.*;
-import org.apache.log4j.xml.*;
-import org.gridgain.grid.*;
-import org.gridgain.grid.util.*;
-import org.gridgain.grid.util.lang.*;
-import org.gridgain.grid.util.tostring.*;
-import org.gridgain.grid.util.typedef.*;
-import org.gridgain.grid.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import static org.gridgain.grid.GridSystemProperties.*;
-
-/**
- * Log4j-based implementation for logging. This logger should be used
- * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/docs/">log4j</a>-based logging.
- * <p>
- * Here is a typical example of configuring log4j logger in GridGain configuration file:
- * <pre name="code" class="xml">
- *      &lt;property name="gridLogger"&gt;
- *          &lt;bean class="org.gridgain.grid.logger.log4j.GridLog4jLogger"&gt;
- *              &lt;constructor-arg type="java.lang.String" value="config/gridgain-log4j.xml"/&gt;
- *          &lt;/bean>
- *      &lt;/property&gt;
- * </pre>
- * and from your code:
- * <pre name="code" class="java">
- *      GridConfiguration cfg = new GridConfiguration();
- *      ...
- *      URL xml = U.resolveGridGainUrl("config/custom-log4j.xml");
- *      GridLogger log = new GridLog4jLogger(xml);
- *      ...
- *      cfg.setGridLogger(log);
- * </pre>
- *
- * Please take a look at <a target=_new href="http://logging.apache.org/log4j/1.2/index.html">Apache Log4j 1.2</a>
- * for additional information.
- * <p>
- * It's recommended to use GridGain logger injection instead of using/instantiating
- * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger
- * injection.
- */
-public class GridLog4jLogger extends GridMetadataAwareAdapter implements IgniteLogger, IgniteLoggerNodeIdAware,
-    GridLog4jFileAware {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Appenders. */
-    private static Collection<FileAppender> fileAppenders = new GridConcurrentHashSet<>();
-
-    /** */
-    private static volatile boolean inited;
-
-    /** */
-    private static volatile boolean quiet0;
-
-    /** */
-    private static final Object mux = new Object();
-
-    /** Logger implementation. */
-    @GridToStringExclude
-    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
-    private Logger impl;
-
-    /** Path to configuration file. */
-    private final String path;
-
-    /** Quiet flag. */
-    private final boolean quiet;
-
-    /** Node ID. */
-    private UUID nodeId;
-
-    /**
-     * Creates new logger and automatically detects if root logger already
-     * has appenders configured. If it does not, the root logger will be
-     * configured with default appender (analogous to calling
-     * {@link #GridLog4jLogger(boolean) GridLog4jLogger(boolean)}
-     * with parameter {@code true}, otherwise, existing appenders will be used (analogous
-     * to calling {@link #GridLog4jLogger(boolean) GridLog4jLogger(boolean)}
-     * with parameter {@code false}).
-     */
-    public GridLog4jLogger() {
-        this(!isConfigured());
-    }
-
-    /**
-     * Creates new logger. If initialize parameter is {@code true} the Log4j
-     * logger will be initialized with default console appender and {@code INFO}
-     * log level.
-     *
-     * @param init If {@code true}, then a default console appender with
-     *      following pattern layout will be created: {@code %d{ABSOLUTE} %-5p [%c{1}] %m%n}.
-     *      If {@code false}, then no implicit initialization will take place,
-     *      and {@code Log4j} should be configured prior to calling this
-     *      constructor.
-     */
-    public GridLog4jLogger(boolean init) {
-        impl = Logger.getRootLogger();
-
-        if (init) {
-            // Implementation has already been inited, passing NULL.
-            addConsoleAppenderIfNeeded(Level.INFO, null);
-
-            quiet = quiet0;
-        }
-        else
-            quiet = true;
-
-        path = null;
-    }
-
-    /**
-     * Creates new logger with given implementation.
-     *
-     * @param impl Log4j implementation to use.
-     */
-    public GridLog4jLogger(final Logger impl) {
-        assert impl != null;
-
-        path = null;
-
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override public Logger apply(Boolean init) {
-                return impl;
-            }
-        });
-
-        quiet = quiet0;
-    }
-
-    /**
-     * Creates new logger with given configuration {@code path}.
-     *
-     * @param path Path to log4j configuration XML file.
-     * @throws GridException Thrown in case logger can't be created.
-     */
-    public GridLog4jLogger(String path) throws GridException {
-        if (path == null)
-            throw new GridException("Configuration XML file for Log4j must be specified.");
-
-        this.path = path;
-
-        final URL cfgUrl = U.resolveGridGainUrl(path);
-
-        if (cfgUrl == null)
-            throw new GridException("Log4j configuration path was not found: " + path);
-
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override public Logger apply(Boolean init) {
-                if (init)
-                    DOMConfigurator.configure(cfgUrl);
-
-                return Logger.getRootLogger();
-            }
-        });
-
-        quiet = quiet0;
-    }
-
-    /**
-     * Creates new logger with given configuration {@code cfgFile}.
-     *
-     * @param cfgFile Log4j configuration XML file.
-     * @throws GridException Thrown in case logger can't be created.
-     */
-    public GridLog4jLogger(File cfgFile) throws GridException {
-        if (cfgFile == null)
-            throw new GridException("Configuration XML file for Log4j must be specified.");
-
-        if (!cfgFile.exists() || cfgFile.isDirectory())
-            throw new GridException("Log4j configuration path was not found or is a directory: " + cfgFile);
-
-        path = cfgFile.getAbsolutePath();
-
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override public Logger apply(Boolean init) {
-                if (init)
-                    DOMConfigurator.configure(path);
-
-                return Logger.getRootLogger();
-            }
-        });
-
-        quiet = quiet0;
-    }
-
-    /**
-     * Creates new logger with given configuration {@code cfgUrl}.
-     *
-     * @param cfgUrl URL for Log4j configuration XML file.
-     * @throws GridException Thrown in case logger can't be created.
-     */
-    public GridLog4jLogger(final URL cfgUrl) throws GridException {
-        if (cfgUrl == null)
-            throw new GridException("Configuration XML file for Log4j must be specified.");
-
-        path = null;
-
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override public Logger apply(Boolean init) {
-                if (init)
-                    DOMConfigurator.configure(cfgUrl);
-
-                return Logger.getRootLogger();
-            }
-        });
-
-        quiet = quiet0;
-    }
-
-    /**
-     * Checks if Log4j is already configured within this VM or not.
-     *
-     * @return {@code True} if log4j was already configured, {@code false} otherwise.
-     */
-    public static boolean isConfigured() {
-        return Logger.getRootLogger().getAllAppenders().hasMoreElements();
-    }
-
-    /**
-     * Sets level for internal log4j implementation.
-     *
-     * @param level Log level to set.
-     */
-    public void setLevel(Level level) {
-        impl.setLevel(level);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public String fileName() {
-        FileAppender fapp = F.first(fileAppenders);
-
-        return fapp != null ? fapp.getFile() : null;
-    }
-
-    /**
-     * Adds console appender when needed with some default logging settings.
-     *
-     * @param logLevel Optional log level.
-     * @param implInitC Optional log implementation init closure.
-     */
-    private void addConsoleAppenderIfNeeded(@Nullable Level logLevel,
-        @Nullable IgniteClosure<Boolean, Logger> implInitC) {
-        if (inited) {
-            if (implInitC != null)
-                // Do not init.
-                impl = implInitC.apply(false);
-
-            return;
-        }
-
-        synchronized (mux) {
-            if (inited) {
-                if (implInitC != null)
-                    // Do not init.
-                    impl = implInitC.apply(false);
-
-                return;
-            }
-
-            if (implInitC != null)
-                // Init logger impl.
-                impl = implInitC.apply(true);
-
-            boolean quiet = Boolean.valueOf(System.getProperty(GG_QUIET, "true"));
-
-            boolean consoleAppenderFound = false;
-            Category rootCategory = null;
-            ConsoleAppender errAppender = null;
-
-            for (Category l = impl; l != null; ) {
-                if (!consoleAppenderFound) {
-                    for (Enumeration appenders = l.getAllAppenders(); appenders.hasMoreElements(); ) {
-                        Appender appender = (Appender)appenders.nextElement();
-
-                        if (appender instanceof ConsoleAppender) {
-                            if ("CONSOLE_ERR".equals(appender.getName())) {
-                                // Treat CONSOLE_ERR appender as a system one and don't count it.
-                                errAppender = (ConsoleAppender)appender;
-
-                                continue;
-                            }
-
-                            consoleAppenderFound = true;
-
-                            break;
-                        }
-                    }
-                }
-
-                if (l.getParent() == null) {
-                    rootCategory = l;
-
-                    break;
-                }
-                else
-                    l = l.getParent();
-            }
-
-            if (consoleAppenderFound && quiet)
-                // User configured console appender, but log is quiet.
-                quiet = false;
-
-            if (!consoleAppenderFound && !quiet && Boolean.valueOf(System.getProperty(GG_CONSOLE_APPENDER, "true"))) {
-                // Console appender not found => we've looked through all categories up to root.
-                assert rootCategory != null;
-
-                // User launched gridgain in verbose mode and did not add console appender with INFO level
-                // to configuration and did not set GG_CONSOLE_APPENDER to false.
-                if (errAppender != null) {
-                    rootCategory.addAppender(createConsoleAppender(Level.INFO));
-
-                    if (errAppender.getThreshold() == Level.ERROR)
-                        errAppender.setThreshold(Level.WARN);
-                }
-                else
-                    // No error console appender => create console appender with no level limit.
-                    rootCategory.addAppender(createConsoleAppender(Level.OFF));
-
-                if (logLevel != null)
-                    impl.setLevel(logLevel);
-            }
-
-            quiet0 = quiet;
-            inited = true;
-        }
-    }
-
-    /**
-     * Creates console appender with some reasonable default logging settings.
-     *
-     * @param maxLevel Max logging level.
-     * @return New console appender.
-     */
-    private Appender createConsoleAppender(Level maxLevel) {
-        String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
-
-        // Configure output that should go to System.out
-        Appender app = new ConsoleAppender(new PatternLayout(fmt), ConsoleAppender.SYSTEM_OUT);
-
-        LevelRangeFilter lvlFilter = new LevelRangeFilter();
-
-        lvlFilter.setLevelMin(Level.TRACE);
-        lvlFilter.setLevelMax(maxLevel);
-
-        app.addFilter(lvlFilter);
-
-        return app;
-    }
-
-    /**
-     * Adds file appender.
-     *
-     * @param a Appender.
-     */
-    public static void addAppender(FileAppender a) {
-        A.notNull(a, "a");
-
-        fileAppenders.add(a);
-    }
-
-    /**
-     * Removes file appender.
-     *
-     * @param a Appender.
-     */
-    public static void removeAppender(FileAppender a) {
-        A.notNull(a, "a");
-
-        fileAppenders.remove(a);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void setNodeId(UUID nodeId) {
-        A.notNull(nodeId, "nodeId");
-
-        this.nodeId = nodeId;
-
-        updateFilePath(new GridLog4jNodeIdFilePath(nodeId));
-    }
-
-    /** {@inheritDoc} */
-    @Override public UUID getNodeId() {
-        return nodeId;
-    }
-
-    /**
-     * Gets files for all registered file appenders.
-     *
-     * @return List of files.
-     */
-    public static Collection<String> logFiles() {
-        Collection<String> res = new ArrayList<>(fileAppenders.size());
-
-        for (FileAppender a : fileAppenders)
-            res.add(a.getFile());
-
-        return res;
-    }
-
-    /**
-     * Gets {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger for the given
-     * category. If category is {@code null}, then root logger is returned. If
-     * category is an instance of {@link Class} then {@code (Class)ctgr).getName()}
-     * is used as category name.
-     *
-     * @param ctgr {@inheritDoc}
-     * @return {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger.
-     */
-    @Override public GridLog4jLogger getLogger(Object ctgr) {
-        return new GridLog4jLogger(ctgr == null ? Logger.getRootLogger() :
-            ctgr instanceof Class ? Logger.getLogger(((Class<?>)ctgr).getName()) :
-                Logger.getLogger(ctgr.toString()));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void trace(String msg) {
-        if (!impl.isTraceEnabled())
-            warning("Logging at TRACE level without checking if TRACE level is enabled: " + msg);
-
-        impl.trace(msg);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void debug(String msg) {
-        if (!impl.isDebugEnabled())
-            warning("Logging at DEBUG level without checking if DEBUG level is enabled: " + msg);
-
-        impl.debug(msg);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void info(String msg) {
-        if (!impl.isInfoEnabled())
-            warning("Logging at INFO level without checking if INFO level is enabled: " + msg);
-
-        impl.info(msg);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void warning(String msg) {
-        impl.warn(msg);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void warning(String msg, @Nullable Throwable e) {
-        impl.warn(msg, e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void error(String msg) {
-        impl.error(msg);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void error(String msg, @Nullable Throwable e) {
-        impl.error(msg, e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isTraceEnabled() {
-        return impl.isTraceEnabled();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isDebugEnabled() {
-        return impl.isDebugEnabled();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isInfoEnabled() {
-        return impl.isInfoEnabled();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isQuiet() {
-        return quiet;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridLog4jLogger.class, this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void updateFilePath(IgniteClosure<String, String> filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        for (FileAppender a : fileAppenders) {
-            if (a instanceof GridLog4jFileAware) {
-                ((GridLog4jFileAware)a).updateFilePath(filePathClos);
-
-                a.activateOptions();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jNodeIdFilePath.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jNodeIdFilePath.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jNodeIdFilePath.java
deleted file mode 100644
index b741808..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jNodeIdFilePath.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.logger.log4j;
-
-import org.apache.ignite.lang.*;
-import org.gridgain.grid.*;
-import org.gridgain.grid.util.typedef.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Closure that generates file path adding node id to filename as a suffix.
- */
-class GridLog4jNodeIdFilePath implements IgniteClosure<String, String> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Node id. */
-    private final UUID nodeId;
-
-    /**
-     * Creates new instance.
-     *
-     * @param id Node id.
-     */
-    GridLog4jNodeIdFilePath(UUID id) {
-        nodeId = id;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String apply(String oldPath) {
-        if (!F.isEmpty(U.GRIDGAIN_LOG_DIR))
-            return U.nodeIdLogFileName(nodeId, new File(U.GRIDGAIN_LOG_DIR, "gridgain.log").getAbsolutePath());
-
-        if (oldPath != null) // fileName could be null if GRIDGAIN_HOME is not defined.
-            return U.nodeIdLogFileName(nodeId, oldPath);
-
-        String tmpDir = GridSystemProperties.getString("java.io.tmpdir");
-
-        if (tmpDir != null)
-            return U.nodeIdLogFileName(nodeId, new File(tmpDir, "gridgain.log").getAbsolutePath());
-
-        System.err.println("Failed to get tmp directory for log file.");
-
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jRollingFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jRollingFileAppender.java
deleted file mode 100644
index cb00de8..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/GridLog4jRollingFileAppender.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.apache.ignite.logger.log4j;
-
-import org.apache.ignite.lang.*;
-import org.apache.log4j.*;
-import org.gridgain.grid.util.typedef.internal.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link RollingFileAppender} with added support for grid node IDs.
- */
-public class GridLog4jRollingFileAppender extends RollingFileAppender implements GridLog4jFileAware {
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public GridLog4jRollingFileAppender() {
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @throws IOException If failed.
-     */
-    public GridLog4jRollingFileAppender(Layout layout, String filename) throws IOException {
-        super(layout, filename);
-
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param append Append flag.
-     * @throws IOException If failed.
-     */
-    public GridLog4jRollingFileAppender(Layout layout, String filename, boolean append) throws IOException {
-        super(layout, filename, append);
-
-        init();
-    }
-
-    /**
-     * Initializes appender.
-     */
-    private void init() {
-        GridLog4jLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jDailyRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jDailyRollingFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jDailyRollingFileAppender.java
new file mode 100644
index 0000000..6f689b2
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jDailyRollingFileAppender.java
@@ -0,0 +1,69 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.logger.log4j;
+
+import org.apache.ignite.lang.*;
+import org.apache.log4j.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link DailyRollingFileAppender} with added support for grid node IDs.
+ */
+public class IgniteLog4jDailyRollingFileAppender extends DailyRollingFileAppender implements IgniteLog4jFileAware {
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public IgniteLog4jDailyRollingFileAppender() {
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param datePtrn Date pattern.
+     * @throws IOException If failed.
+     */
+    public IgniteLog4jDailyRollingFileAppender(Layout layout, String filename, String datePtrn) throws IOException {
+        super(layout, filename, datePtrn);
+
+        init();
+    }
+
+    /**
+     *
+     */
+    private void init() {
+        IgniteLog4jLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jExternallyRolledFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jExternallyRolledFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jExternallyRolledFileAppender.java
new file mode 100644
index 0000000..673cd7b
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jExternallyRolledFileAppender.java
@@ -0,0 +1,55 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.logger.log4j;
+
+import org.apache.ignite.lang.*;
+import org.apache.log4j.varia.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link ExternallyRolledFileAppender} with added support for grid node IDs.
+ */
+public class IgniteLog4jExternallyRolledFileAppender extends ExternallyRolledFileAppender implements IgniteLog4jFileAware {
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public IgniteLog4jExternallyRolledFileAppender() {
+        init();
+    }
+
+    /**
+     *
+     */
+    private void init() {
+        IgniteLog4jLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAppender.java
new file mode 100644
index 0000000..2117667
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAppender.java
@@ -0,0 +1,99 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.logger.log4j;
+
+import org.apache.ignite.lang.*;
+import org.apache.log4j.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link FileAppender} with added support for grid node IDs.
+ */
+public class IgniteLog4jFileAppender extends FileAppender implements IgniteLog4jFileAware {
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public IgniteLog4jFileAppender() {
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @throws IOException If failed.
+     */
+    public IgniteLog4jFileAppender(Layout layout, String filename) throws IOException {
+        super(layout, filename);
+
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param append Append flag.
+     * @throws IOException If failed.
+     */
+    public IgniteLog4jFileAppender(Layout layout, String filename, boolean append) throws IOException {
+        super(layout, filename, append);
+
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param append Append flag.
+     * @param bufIO Buffered IO flag.
+     * @param bufSize Buffer size.
+     * @throws IOException If failed.
+     */
+    public IgniteLog4jFileAppender(Layout layout, String filename, boolean append, boolean bufIO, int bufSize)
+        throws IOException {
+        super(layout, filename, append, bufIO, bufSize);
+
+        init();
+    }
+
+    /**
+     *
+     */
+    private void init() {
+        IgniteLog4jLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java
new file mode 100644
index 0000000..9b36701
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java
@@ -0,0 +1,24 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.logger.log4j;
+
+import org.apache.ignite.lang.*;
+
+/**
+ * Interface for those loggers and appenders that evaluate their file paths lazily.
+ */
+interface IgniteLog4jFileAware {
+    /**
+     * Sets closure that later evaluate file path.
+     *
+     * @param filePathClos Closure that generates actual file path.
+     */
+    void updateFilePath(IgniteClosure<String, String> filePathClos);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java
new file mode 100644
index 0000000..87502ab
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java
@@ -0,0 +1,516 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.logger.log4j;
+
+import org.apache.ignite.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.logger.*;
+import org.apache.log4j.*;
+import org.apache.log4j.varia.*;
+import org.apache.log4j.xml.*;
+import org.gridgain.grid.*;
+import org.gridgain.grid.util.*;
+import org.gridgain.grid.util.lang.*;
+import org.gridgain.grid.util.tostring.*;
+import org.gridgain.grid.util.typedef.*;
+import org.gridgain.grid.util.typedef.internal.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import static org.gridgain.grid.GridSystemProperties.*;
+
+/**
+ * Log4j-based implementation for logging. This logger should be used
+ * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/docs/">log4j</a>-based logging.
+ * <p>
+ * Here is a typical example of configuring log4j logger in GridGain configuration file:
+ * <pre name="code" class="xml">
+ *      &lt;property name="gridLogger"&gt;
+ *          &lt;bean class="org.gridgain.grid.logger.log4j.GridLog4jLogger"&gt;
+ *              &lt;constructor-arg type="java.lang.String" value="config/gridgain-log4j.xml"/&gt;
+ *          &lt;/bean>
+ *      &lt;/property&gt;
+ * </pre>
+ * and from your code:
+ * <pre name="code" class="java">
+ *      GridConfiguration cfg = new GridConfiguration();
+ *      ...
+ *      URL xml = U.resolveGridGainUrl("config/custom-log4j.xml");
+ *      GridLogger log = new GridLog4jLogger(xml);
+ *      ...
+ *      cfg.setGridLogger(log);
+ * </pre>
+ *
+ * Please take a look at <a target=_new href="http://logging.apache.org/log4j/1.2/index.html">Apache Log4j 1.2</a>
+ * for additional information.
+ * <p>
+ * It's recommended to use GridGain logger injection instead of using/instantiating
+ * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger
+ * injection.
+ */
+public class IgniteLog4jLogger extends GridMetadataAwareAdapter implements IgniteLogger, IgniteLoggerNodeIdAware,
+    IgniteLog4jFileAware {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Appenders. */
+    private static Collection<FileAppender> fileAppenders = new GridConcurrentHashSet<>();
+
+    /** */
+    private static volatile boolean inited;
+
+    /** */
+    private static volatile boolean quiet0;
+
+    /** */
+    private static final Object mux = new Object();
+
+    /** Logger implementation. */
+    @GridToStringExclude
+    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
+    private Logger impl;
+
+    /** Path to configuration file. */
+    private final String path;
+
+    /** Quiet flag. */
+    private final boolean quiet;
+
+    /** Node ID. */
+    private UUID nodeId;
+
+    /**
+     * Creates new logger and automatically detects if root logger already
+     * has appenders configured. If it does not, the root logger will be
+     * configured with default appender (analogous to calling
+     * {@link #IgniteLog4jLogger(boolean) GridLog4jLogger(boolean)}
+     * with parameter {@code true}, otherwise, existing appenders will be used (analogous
+     * to calling {@link #IgniteLog4jLogger(boolean) GridLog4jLogger(boolean)}
+     * with parameter {@code false}).
+     */
+    public IgniteLog4jLogger() {
+        this(!isConfigured());
+    }
+
+    /**
+     * Creates new logger. If initialize parameter is {@code true} the Log4j
+     * logger will be initialized with default console appender and {@code INFO}
+     * log level.
+     *
+     * @param init If {@code true}, then a default console appender with
+     *      following pattern layout will be created: {@code %d{ABSOLUTE} %-5p [%c{1}] %m%n}.
+     *      If {@code false}, then no implicit initialization will take place,
+     *      and {@code Log4j} should be configured prior to calling this
+     *      constructor.
+     */
+    public IgniteLog4jLogger(boolean init) {
+        impl = Logger.getRootLogger();
+
+        if (init) {
+            // Implementation has already been inited, passing NULL.
+            addConsoleAppenderIfNeeded(Level.INFO, null);
+
+            quiet = quiet0;
+        }
+        else
+            quiet = true;
+
+        path = null;
+    }
+
+    /**
+     * Creates new logger with given implementation.
+     *
+     * @param impl Log4j implementation to use.
+     */
+    public IgniteLog4jLogger(final Logger impl) {
+        assert impl != null;
+
+        path = null;
+
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                return impl;
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Creates new logger with given configuration {@code path}.
+     *
+     * @param path Path to log4j configuration XML file.
+     * @throws GridException Thrown in case logger can't be created.
+     */
+    public IgniteLog4jLogger(String path) throws GridException {
+        if (path == null)
+            throw new GridException("Configuration XML file for Log4j must be specified.");
+
+        this.path = path;
+
+        final URL cfgUrl = U.resolveGridGainUrl(path);
+
+        if (cfgUrl == null)
+            throw new GridException("Log4j configuration path was not found: " + path);
+
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    DOMConfigurator.configure(cfgUrl);
+
+                return Logger.getRootLogger();
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Creates new logger with given configuration {@code cfgFile}.
+     *
+     * @param cfgFile Log4j configuration XML file.
+     * @throws GridException Thrown in case logger can't be created.
+     */
+    public IgniteLog4jLogger(File cfgFile) throws GridException {
+        if (cfgFile == null)
+            throw new GridException("Configuration XML file for Log4j must be specified.");
+
+        if (!cfgFile.exists() || cfgFile.isDirectory())
+            throw new GridException("Log4j configuration path was not found or is a directory: " + cfgFile);
+
+        path = cfgFile.getAbsolutePath();
+
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    DOMConfigurator.configure(path);
+
+                return Logger.getRootLogger();
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Creates new logger with given configuration {@code cfgUrl}.
+     *
+     * @param cfgUrl URL for Log4j configuration XML file.
+     * @throws GridException Thrown in case logger can't be created.
+     */
+    public IgniteLog4jLogger(final URL cfgUrl) throws GridException {
+        if (cfgUrl == null)
+            throw new GridException("Configuration XML file for Log4j must be specified.");
+
+        path = null;
+
+        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    DOMConfigurator.configure(cfgUrl);
+
+                return Logger.getRootLogger();
+            }
+        });
+
+        quiet = quiet0;
+    }
+
+    /**
+     * Checks if Log4j is already configured within this VM or not.
+     *
+     * @return {@code True} if log4j was already configured, {@code false} otherwise.
+     */
+    public static boolean isConfigured() {
+        return Logger.getRootLogger().getAllAppenders().hasMoreElements();
+    }
+
+    /**
+     * Sets level for internal log4j implementation.
+     *
+     * @param level Log level to set.
+     */
+    public void setLevel(Level level) {
+        impl.setLevel(level);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public String fileName() {
+        FileAppender fapp = F.first(fileAppenders);
+
+        return fapp != null ? fapp.getFile() : null;
+    }
+
+    /**
+     * Adds console appender when needed with some default logging settings.
+     *
+     * @param logLevel Optional log level.
+     * @param implInitC Optional log implementation init closure.
+     */
+    private void addConsoleAppenderIfNeeded(@Nullable Level logLevel,
+        @Nullable IgniteClosure<Boolean, Logger> implInitC) {
+        if (inited) {
+            if (implInitC != null)
+                // Do not init.
+                impl = implInitC.apply(false);
+
+            return;
+        }
+
+        synchronized (mux) {
+            if (inited) {
+                if (implInitC != null)
+                    // Do not init.
+                    impl = implInitC.apply(false);
+
+                return;
+            }
+
+            if (implInitC != null)
+                // Init logger impl.
+                impl = implInitC.apply(true);
+
+            boolean quiet = Boolean.valueOf(System.getProperty(GG_QUIET, "true"));
+
+            boolean consoleAppenderFound = false;
+            Category rootCategory = null;
+            ConsoleAppender errAppender = null;
+
+            for (Category l = impl; l != null; ) {
+                if (!consoleAppenderFound) {
+                    for (Enumeration appenders = l.getAllAppenders(); appenders.hasMoreElements(); ) {
+                        Appender appender = (Appender)appenders.nextElement();
+
+                        if (appender instanceof ConsoleAppender) {
+                            if ("CONSOLE_ERR".equals(appender.getName())) {
+                                // Treat CONSOLE_ERR appender as a system one and don't count it.
+                                errAppender = (ConsoleAppender)appender;
+
+                                continue;
+                            }
+
+                            consoleAppenderFound = true;
+
+                            break;
+                        }
+                    }
+                }
+
+                if (l.getParent() == null) {
+                    rootCategory = l;
+
+                    break;
+                }
+                else
+                    l = l.getParent();
+            }
+
+            if (consoleAppenderFound && quiet)
+                // User configured console appender, but log is quiet.
+                quiet = false;
+
+            if (!consoleAppenderFound && !quiet && Boolean.valueOf(System.getProperty(GG_CONSOLE_APPENDER, "true"))) {
+                // Console appender not found => we've looked through all categories up to root.
+                assert rootCategory != null;
+
+                // User launched gridgain in verbose mode and did not add console appender with INFO level
+                // to configuration and did not set GG_CONSOLE_APPENDER to false.
+                if (errAppender != null) {
+                    rootCategory.addAppender(createConsoleAppender(Level.INFO));
+
+                    if (errAppender.getThreshold() == Level.ERROR)
+                        errAppender.setThreshold(Level.WARN);
+                }
+                else
+                    // No error console appender => create console appender with no level limit.
+                    rootCategory.addAppender(createConsoleAppender(Level.OFF));
+
+                if (logLevel != null)
+                    impl.setLevel(logLevel);
+            }
+
+            quiet0 = quiet;
+            inited = true;
+        }
+    }
+
+    /**
+     * Creates console appender with some reasonable default logging settings.
+     *
+     * @param maxLevel Max logging level.
+     * @return New console appender.
+     */
+    private Appender createConsoleAppender(Level maxLevel) {
+        String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+
+        // Configure output that should go to System.out
+        Appender app = new ConsoleAppender(new PatternLayout(fmt), ConsoleAppender.SYSTEM_OUT);
+
+        LevelRangeFilter lvlFilter = new LevelRangeFilter();
+
+        lvlFilter.setLevelMin(Level.TRACE);
+        lvlFilter.setLevelMax(maxLevel);
+
+        app.addFilter(lvlFilter);
+
+        return app;
+    }
+
+    /**
+     * Adds file appender.
+     *
+     * @param a Appender.
+     */
+    public static void addAppender(FileAppender a) {
+        A.notNull(a, "a");
+
+        fileAppenders.add(a);
+    }
+
+    /**
+     * Removes file appender.
+     *
+     * @param a Appender.
+     */
+    public static void removeAppender(FileAppender a) {
+        A.notNull(a, "a");
+
+        fileAppenders.remove(a);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNodeId(UUID nodeId) {
+        A.notNull(nodeId, "nodeId");
+
+        this.nodeId = nodeId;
+
+        updateFilePath(new IgniteLog4jNodeIdFilePath(nodeId));
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID getNodeId() {
+        return nodeId;
+    }
+
+    /**
+     * Gets files for all registered file appenders.
+     *
+     * @return List of files.
+     */
+    public static Collection<String> logFiles() {
+        Collection<String> res = new ArrayList<>(fileAppenders.size());
+
+        for (FileAppender a : fileAppenders)
+            res.add(a.getFile());
+
+        return res;
+    }
+
+    /**
+     * Gets {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger for the given
+     * category. If category is {@code null}, then root logger is returned. If
+     * category is an instance of {@link Class} then {@code (Class)ctgr).getName()}
+     * is used as category name.
+     *
+     * @param ctgr {@inheritDoc}
+     * @return {@link org.apache.ignite.IgniteLogger} wrapper around log4j logger.
+     */
+    @Override public IgniteLog4jLogger getLogger(Object ctgr) {
+        return new IgniteLog4jLogger(ctgr == null ? Logger.getRootLogger() :
+            ctgr instanceof Class ? Logger.getLogger(((Class<?>)ctgr).getName()) :
+                Logger.getLogger(ctgr.toString()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void trace(String msg) {
+        if (!impl.isTraceEnabled())
+            warning("Logging at TRACE level without checking if TRACE level is enabled: " + msg);
+
+        impl.trace(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void debug(String msg) {
+        if (!impl.isDebugEnabled())
+            warning("Logging at DEBUG level without checking if DEBUG level is enabled: " + msg);
+
+        impl.debug(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void info(String msg) {
+        if (!impl.isInfoEnabled())
+            warning("Logging at INFO level without checking if INFO level is enabled: " + msg);
+
+        impl.info(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void warning(String msg) {
+        impl.warn(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void warning(String msg, @Nullable Throwable e) {
+        impl.warn(msg, e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void error(String msg) {
+        impl.error(msg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void error(String msg, @Nullable Throwable e) {
+        impl.error(msg, e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isTraceEnabled() {
+        return impl.isTraceEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDebugEnabled() {
+        return impl.isDebugEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isInfoEnabled() {
+        return impl.isInfoEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isQuiet() {
+        return quiet;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IgniteLog4jLogger.class, this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateFilePath(IgniteClosure<String, String> filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        for (FileAppender a : fileAppenders) {
+            if (a instanceof IgniteLog4jFileAware) {
+                ((IgniteLog4jFileAware)a).updateFilePath(filePathClos);
+
+                a.activateOptions();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java
new file mode 100644
index 0000000..1b8afce
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java
@@ -0,0 +1,56 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.logger.log4j;
+
+import org.apache.ignite.lang.*;
+import org.gridgain.grid.*;
+import org.gridgain.grid.util.typedef.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Closure that generates file path adding node id to filename as a suffix.
+ */
+class IgniteLog4jNodeIdFilePath implements IgniteClosure<String, String> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Node id. */
+    private final UUID nodeId;
+
+    /**
+     * Creates new instance.
+     *
+     * @param id Node id.
+     */
+    IgniteLog4jNodeIdFilePath(UUID id) {
+        nodeId = id;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String apply(String oldPath) {
+        if (!F.isEmpty(U.GRIDGAIN_LOG_DIR))
+            return U.nodeIdLogFileName(nodeId, new File(U.GRIDGAIN_LOG_DIR, "gridgain.log").getAbsolutePath());
+
+        if (oldPath != null) // fileName could be null if GRIDGAIN_HOME is not defined.
+            return U.nodeIdLogFileName(nodeId, oldPath);
+
+        String tmpDir = GridSystemProperties.getString("java.io.tmpdir");
+
+        if (tmpDir != null)
+            return U.nodeIdLogFileName(nodeId, new File(tmpDir, "gridgain.log").getAbsolutePath());
+
+        System.err.println("Failed to get tmp directory for log file.");
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jRollingFileAppender.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jRollingFileAppender.java
new file mode 100644
index 0000000..f0db9d9
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jRollingFileAppender.java
@@ -0,0 +1,82 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.logger.log4j;
+
+import org.apache.ignite.lang.*;
+import org.apache.log4j.*;
+import org.gridgain.grid.util.typedef.internal.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link RollingFileAppender} with added support for grid node IDs.
+ */
+public class IgniteLog4jRollingFileAppender extends RollingFileAppender implements IgniteLog4jFileAware {
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public IgniteLog4jRollingFileAppender() {
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @throws IOException If failed.
+     */
+    public IgniteLog4jRollingFileAppender(Layout layout, String filename) throws IOException {
+        super(layout, filename);
+
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param append Append flag.
+     * @throws IOException If failed.
+     */
+    public IgniteLog4jRollingFileAppender(Layout layout, String filename, boolean append) throws IOException {
+        super(layout, filename, append);
+
+        init();
+    }
+
+    /**
+     * Initializes appender.
+     */
+    private void init() {
+        IgniteLog4jLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String> filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jCorrectFileNameTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jCorrectFileNameTest.java b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jCorrectFileNameTest.java
index 83a5d3b..ed87cf0 100644
--- a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jCorrectFileNameTest.java
+++ b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jCorrectFileNameTest.java
@@ -28,14 +28,14 @@ import java.util.*;
 @GridCommonTest(group = "Logger")
 public class GridLog4jCorrectFileNameTest extends TestCase {
     /** Appender */
-    private GridLog4jRollingFileAppender appender;
+    private IgniteLog4jRollingFileAppender appender;
 
     /** {@inheritDoc} */
     @Override protected void setUp() throws Exception {
         Logger root = Logger.getRootLogger();
 
         for (Enumeration appenders = root.getAllAppenders(); appenders.hasMoreElements(); ) {
-            if (appenders.nextElement() instanceof GridLog4jRollingFileAppender)
+            if (appenders.nextElement() instanceof IgniteLog4jRollingFileAppender)
                 return;
         }
 
@@ -47,9 +47,9 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
     /** {@inheritDoc} */
     @Override public void tearDown() {
         if (appender != null) {
-            Logger.getRootLogger().removeAppender(GridLog4jRollingFileAppender.class.getSimpleName());
+            Logger.getRootLogger().removeAppender(IgniteLog4jRollingFileAppender.class.getSimpleName());
 
-            GridLog4jLogger.removeAppender(appender);
+            IgniteLog4jLogger.removeAppender(appender);
         }
     }
 
@@ -97,7 +97,7 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
         IgniteConfiguration cfg = new IgniteConfiguration();
 
         cfg.setGridName(gridName);
-        cfg.setGridLogger(new GridLog4jLogger());
+        cfg.setGridLogger(new IgniteLog4jLogger());
         cfg.setRestEnabled(false);
 
         return cfg;
@@ -109,12 +109,12 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
      * @return GridLog4jRollingFileAppender.
      * @throws Exception If error occurred.
      */
-    private static GridLog4jRollingFileAppender createAppender() throws Exception {
-        GridLog4jRollingFileAppender appender = new GridLog4jRollingFileAppender();
+    private static IgniteLog4jRollingFileAppender createAppender() throws Exception {
+        IgniteLog4jRollingFileAppender appender = new IgniteLog4jRollingFileAppender();
 
         appender.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
         appender.setFile("work/log/gridgain.log");
-        appender.setName(GridLog4jRollingFileAppender.class.getSimpleName());
+        appender.setName(IgniteLog4jRollingFileAppender.class.getSimpleName());
 
         LevelRangeFilter lvlFilter = new LevelRangeFilter();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jInitializedTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jInitializedTest.java b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jInitializedTest.java
index 54ea5c1..0d24540 100644
--- a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jInitializedTest.java
+++ b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jInitializedTest.java
@@ -30,7 +30,7 @@ public class GridLog4jInitializedTest extends TestCase {
 
     /** */
     public void testLogInitialize() {
-        IgniteLogger log = new GridLog4jLogger();
+        IgniteLogger log = new IgniteLog4jLogger();
 
         assert log.isInfoEnabled() == true;
 
@@ -43,6 +43,6 @@ public class GridLog4jInitializedTest extends TestCase {
         log.error("This is 'error' message.");
         log.error("This is 'error' message.", new Exception("It's a test error exception"));
 
-        assert log.getLogger(GridLog4jInitializedTest.class.getName()) instanceof GridLog4jLogger;
+        assert log.getLogger(GridLog4jInitializedTest.class.getName()) instanceof IgniteLog4jLogger;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingFileTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingFileTest.java b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingFileTest.java
index fa82eb1..ce6e04f 100644
--- a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingFileTest.java
+++ b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingFileTest.java
@@ -31,7 +31,7 @@ public class GridLog4jLoggingFileTest extends TestCase {
         assert xml != null;
         assert xml.exists() == true;
 
-        log = new GridLog4jLogger(xml).getLogger(getClass());
+        log = new IgniteLog4jLogger(xml).getLogger(getClass());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingPathTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingPathTest.java b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingPathTest.java
index 0457d54..1bb008f 100644
--- a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingPathTest.java
+++ b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingPathTest.java
@@ -24,7 +24,7 @@ public class GridLog4jLoggingPathTest extends TestCase {
 
     /** {@inheritDoc} */
     @Override protected void setUp() throws Exception {
-        log = new GridLog4jLogger("modules/core/src/test/config/log4j-test.xml").getLogger(getClass());
+        log = new IgniteLog4jLogger("modules/core/src/test/config/log4j-test.xml").getLogger(getClass());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingUrlTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingUrlTest.java b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingUrlTest.java
index 951b920..bbbde8e 100644
--- a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingUrlTest.java
+++ b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jLoggingUrlTest.java
@@ -31,7 +31,7 @@ public class GridLog4jLoggingUrlTest extends TestCase {
         assert xml != null;
         assert xml.exists();
 
-        log = new GridLog4jLogger(xml.toURI().toURL()).getLogger(getClass());
+        log = new IgniteLog4jLogger(xml.toURI().toURL()).getLogger(getClass());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff14819b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jNotInitializedTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jNotInitializedTest.java b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jNotInitializedTest.java
index 2b5a0a9..7ba4778 100644
--- a/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jNotInitializedTest.java
+++ b/modules/log4j/src/test/java/org/gridgain/grid/logger/log4j/GridLog4jNotInitializedTest.java
@@ -21,7 +21,7 @@ import org.gridgain.testframework.junits.common.*;
 public class GridLog4jNotInitializedTest extends TestCase {
     /** */
     public void testLogInitialize() {
-        IgniteLogger log = new GridLog4jLogger().getLogger(GridLog4jNotInitializedTest.class);
+        IgniteLogger log = new IgniteLog4jLogger().getLogger(GridLog4jNotInitializedTest.class);
 
         if (log.isDebugEnabled())
             log.debug("This is 'debug' message.");


Mime
View raw message