You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/07/24 19:23:00 UTC

[37/39] incubator-ignite git commit: # ignite-788: review

# ignite-788: review


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

Branch: refs/heads/ignite-gg-10576
Commit: 928c5e2cc0a154ff81357135ab191ea2a648ac98
Parents: 6894a87
Author: ashutak <as...@gridgain.com>
Authored: Fri Jul 24 17:00:42 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jul 24 17:00:42 2015 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |   5 +
 assembly/release-base.xml                       |   5 +
 config/ignite-log4j2.xml                        | 114 ++--
 .../apache/ignite/internal/IgniteKernal.java    |  40 +-
 modules/core/src/test/config/log4j2-test.xml    |  88 ++-
 .../src/test/config/log4j2-verbose-test.xml     |  48 ++
 modules/log4j/README.txt                        |   2 +-
 .../apache/ignite/logger/log4j/Log4JLogger.java |   2 +-
 modules/log4j2/README.txt                       |   2 +-
 modules/log4j2/pom.xml                          |  30 +-
 .../ignite/logger/log4j2/Log4J2Logger.java      | 626 +++++++++----------
 .../ignite/logger/log4j2/package-info.java      |   1 -
 .../logger/log4j2/Log4j2LoggerSelfTest.java     | 174 ++++++
 .../log4j2/Log4j2LoggerVerboseModeSelfTest.java | 117 ++++
 .../testsuites/IgniteLog4j2TestSuite.java       |  13 +-
 15 files changed, 784 insertions(+), 483 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 73ea48b..ce180c7 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,11 @@
 Apache Ignite Release Notes
 ===========================
 
+Apache Ignite In-Memory Data Fabric 1.4
+---------------------------------------
+* Added support for log4j2.
+
+
 Apache Ignite In-Memory Data Fabric 1.3
 ---------------------------------------
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/assembly/release-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-base.xml b/assembly/release-base.xml
index 4137566..c95966a 100644
--- a/assembly/release-base.xml
+++ b/assembly/release-base.xml
@@ -43,6 +43,11 @@
         </file>
 
         <file>
+            <source>config/ignite-log4j2.xml</source>
+            <outputDirectory>/config</outputDirectory>
+        </file>
+
+        <file>
             <source>config/java.util.logging.properties</source>
             <outputDirectory>/config</outputDirectory>
         </file>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/config/ignite-log4j2.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml b/config/ignite-log4j2.xml
index 3c4af7a..c9c349e 100644
--- a/config/ignite-log4j2.xml
+++ b/config/ignite-log4j2.xml
@@ -7,59 +7,75 @@
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
+
        http://www.apache.org/licenses/LICENSE-2.0
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-  Configuration file for apache ignite 2 
-  -->
-<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
-    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
-<Configuration status="debug" strict="true" name="XMLConfigTest"
-               packages="org.apache.ignite.logger.log4j2">
-  <Filter type="ThresholdFilter" level="TRACE"/>
-  <Appenders>
-    <Appender type="Console" name="CONSOLE_ERR">
-    </Appender>
-	<Routing name="Routing">	
-	   <Routes pattern="$${ctx:ROUTINGKEY}">
-	   <Route key="$${ctx:ROUTINGKEY}">
-		  <RollingFile name="Rolling-default" fileName="work/log/ignite.log"
-					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
-			<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
-			</PatternLayout>
-			<Policies>
-			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-			  <SizeBasedTriggeringPolicy size="10 MB" />
-			</Policies>
-		  </RollingFile>
-		</Route>
-	   <Route>
-		<RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
-					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
-		<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
-		</PatternLayout>
-		<Policies>
-		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-		  <SizeBasedTriggeringPolicy size="10 MB" />
-		</Policies>
-		  </RollingFile>
-		</Route>
-		  </Routes>
-		</Routing>
-	</Appenders>
-  <Loggers>
-    <Logger name="org.springframework" level="warn"/>
-    <Logger name="rg.eclipse.jetty" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
-    <Logger name="com.amazonaws" level="warn"/>
-    <Root level="TRACE">
-    	<AppenderRef ref="Routing"/>
-   </Root>
-  </Loggers>
+-->
+
+<Configuration>
+    <Appenders>
+        <Console name="CONSOLE" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+            <ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
+        </Console>
+
+        <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+        </Console>
+
+        <Routing name="FILE">
+            <Routes pattern="$${sys:nodeId}">
+                <Route>
+                    <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
+                                 filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
+                        <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+                        <Policies>
+                            <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+                            <SizeBasedTriggeringPolicy size="10 MB" />
+                        </Policies>
+                    </RollingFile>
+                </Route>
+            </Routes>
+        </Routing>
+    </Appenders>
+
+    <Loggers>
+        <!--
+        <Logger name="org.apache.ignite" level=DEBUG/>
+        -->
+
+        <!--
+            Uncomment to disable courtesy notices, such as SPI configuration
+            consistency warnings.
+        -->
+        <!--
+        <Logger name="org.apache.ignite.CourtesyConfigNotice" level=OFF/>
+        -->
+
+        <Logger name="org.springframework" level="WARN"/>
+        <Logger name="org.eclipse.jetty" level="WARN"/>
+
+        <!--
+        Avoid warnings about failed bind attempt when multiple nodes running on the same host.
+        -->
+        <Logger name="org.eclipse.jetty.util.log" level="ERROR"/>
+        <Logger name="org.eclipse.jetty.util.component" level="ERROR"/>
+
+        <Logger name="com.amazonaws" level="WARN"/>
+
+        <Root level="INFO">
+            <!-- Uncomment to enable logging to console. -->
+            <!--
+            <AppenderRef ref="CONSOLE" level="DEBUG"/>
+            -->
+
+            <AppenderRef ref="CONSOLE_ERR" level="ERROR"/>
+            <AppenderRef ref="FILE" level="DEBUG"/>
+        </Root>
+    </Loggers>
 </Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 3f340d1..99c86ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1487,13 +1487,25 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     private void ackAsciiLogo() {
         assert log != null;
 
-        String fileName = log.fileName();
-
         if (System.getProperty(IGNITE_NO_ASCII) == null) {
             String ver = "ver. " + ACK_VER_STR;
 
             // Big thanks to: http://patorjk.com/software/taag
             // Font name "Small Slant"
+            if (log.isInfoEnabled()) {
+                log.info(NL + NL +
+                        ">>>    __________  ________________  " + NL +
+                        ">>>   /  _/ ___/ |/ /  _/_  __/ __/  " + NL +
+                        ">>>  _/ // (7 7    // /  / / / _/    " + NL +
+                        ">>> /___/\\___/_/|_/___/ /_/ /___/   " + NL +
+                        ">>> " + NL +
+                        ">>> " + ver + NL +
+                        ">>> " + COPYRIGHT + NL +
+                        ">>> " + NL +
+                        ">>> Ignite documentation: " + "http://" + SITE + NL
+                );
+            }
+
             if (log.isQuiet()) {
                 U.quiet(false,
                     "   __________  ________________ ",
@@ -1508,27 +1520,15 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
                     "",
                     "Quiet mode.");
 
+                String fileName = log.fileName();
+
                 if (fileName != null)
-                    U.quiet(false, "  ^-- Logging to file '" +  fileName + '\'');
+                    U.quiet(false, "  ^-- Logging to file '" + fileName + '\'');
 
                 U.quiet(false,
                     "  ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or \"-v\" to ignite.{sh|bat}",
                     "");
             }
-
-            if (log.isInfoEnabled()) {
-                log.info(NL + NL +
-                        ">>>    __________  ________________  " + NL +
-                        ">>>   /  _/ ___/ |/ /  _/_  __/ __/  " + NL +
-                        ">>>  _/ // (7 7    // /  / / / _/    " + NL +
-                        ">>> /___/\\___/_/|_/___/ /_/ /___/   " + NL +
-                        ">>> " + NL +
-                        ">>> " + ver + NL +
-                        ">>> " + COPYRIGHT + NL +
-                        ">>> " + NL +
-                        ">>> Ignite documentation: " + "http://" + SITE + NL
-                );
-            }
         }
     }
 
@@ -2730,8 +2730,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     @Nullable @Override public <T, S> IgniteAtomicStamped<T, S> atomicStamped(String name,
         @Nullable T initVal,
         @Nullable S initStamp,
-        boolean create)
-    {
+        boolean create) {
         guard();
 
         try {
@@ -2749,8 +2748,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     @Nullable @Override public IgniteCountDownLatch countDownLatch(String name,
         int cnt,
         boolean autoDel,
-        boolean create)
-    {
+        boolean create) {
         guard();
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/core/src/test/config/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-test.xml b/modules/core/src/test/config/log4j2-test.xml
index fcfae43..30599cc 100644
--- a/modules/core/src/test/config/log4j2-test.xml
+++ b/modules/core/src/test/config/log4j2-test.xml
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+
 <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
@@ -6,58 +7,51 @@
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
+
        http://www.apache.org/licenses/LICENSE-2.0
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
-    "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
-<Configuration status="debug" strict="true" name="XMLConfigTest"
-               packages="org.apache.ignite.logger.log4j2">
-  <Filter type="ThresholdFilter" level="TRACE"/>
-  <Appenders>
-    <Appender type="Console" name="CONSOLE_ERR">
-    </Appender>
-	<Routing name="Routing">	
-	   <Routes pattern="$${ctx:ROUTINGKEY}">
-	   <Route key="$${ctx:ROUTINGKEY}">
-		  <RollingFile name="Rolling-default" fileName="work/log/ignite.log"
-					filePattern="work/log/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
-			<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n</pattern>
-			</PatternLayout>
-			<Policies>
-			  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-			  <SizeBasedTriggeringPolicy size="10 MB" />
-			</Policies>
-		  </RollingFile>
-		</Route>
-	   <Route>
-		  <RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="work/log/ignite-${ctx:ROUTINGKEY}.log"
-					filePattern="work/log/${date:yyyy-MM}/ignite-${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
-		<PatternLayout>
-		  <pattern>[%d{ABSOLUTE}][%-5p] $${ctx:nodeidmsg}[%t][%c{1}]%msg%n</pattern>
-		</PatternLayout>
-		<Policies>
-		  <TimeBasedTriggeringPolicy interval="6" modulate="true" />
-		  <SizeBasedTriggeringPolicy size="10 MB" />
-		</Policies>
-		  </RollingFile>
-		</Route>
-		  </Routes>
-		</Routing>
-	</Appenders>
-  <Loggers>
-    <Logger name="org.springframework" level="warn"/>
-    <Logger name="rg.eclipse.jetty" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.log" level="warn"/>
-    <Logger name="org.eclipse.jetty.util.component" level="warn"/>
-    <Logger name="com.amazonaws" level="warn"/>
-    <Root level="TRACE">
-    	<AppenderRef ref="Routing"/>
-   </Root>
-  </Loggers>
+
+<Configuration>
+    <Appenders>
+        <Console name="CONSOLE" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+            <ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
+        </Console>
+
+        <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+        </Console>
+
+        <Routing name="FILE">
+            <Routes pattern="$${sys:nodeId}">
+                <Route>
+                    <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
+                                 filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
+                        <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+                        <Policies>
+                            <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+                            <SizeBasedTriggeringPolicy size="10 MB" />
+                        </Policies>
+                    </RollingFile>
+                </Route>
+            </Routes>
+        </Routing>
+    </Appenders>
+
+    <Loggers>
+        <Logger name="org" level="INFO"/>
+        <Logger name="org.eclipse.jetty" level="INFO"/>
+
+        <Root level="INFO">
+            <AppenderRef ref="CONSOLE" level="DEBUG"/>
+            <AppenderRef ref="CONSOLE_ERR" level="WARN"/>
+            <AppenderRef ref="FILE" level="DEBUG"/>
+        </Root>
+    </Loggers>
 </Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/core/src/test/config/log4j2-verbose-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-verbose-test.xml b/modules/core/src/test/config/log4j2-verbose-test.xml
new file mode 100644
index 0000000..b870dc8
--- /dev/null
+++ b/modules/core/src/test/config/log4j2-verbose-test.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<Configuration>
+    <Appenders>
+        <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
+            <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+        </Console>
+
+        <Routing name="FILE">
+            <Routes pattern="$${sys:nodeId}">
+                <Route>
+                    <RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
+                                 filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
+                        <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+                        <Policies>
+                            <TimeBasedTriggeringPolicy interval="6" modulate="true" />
+                            <SizeBasedTriggeringPolicy size="10 MB" />
+                        </Policies>
+                    </RollingFile>
+                </Route>
+            </Routes>
+        </Routing>
+    </Appenders>
+
+    <Loggers>
+        <Root level="INFO">
+            <AppenderRef ref="CONSOLE_ERR" level="WARN"/>
+            <AppenderRef ref="FILE" level="DEBUG"/>
+        </Root>
+    </Loggers>
+</Configuration>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j/README.txt
----------------------------------------------------------------------
diff --git a/modules/log4j/README.txt b/modules/log4j/README.txt
index 9ca3c55..4bd1b4b 100644
--- a/modules/log4j/README.txt
+++ b/modules/log4j/README.txt
@@ -1,7 +1,7 @@
 Apache Ignite Log4J Module
 --------------------------
 
-Apache Ignite Log4J module provides GridLogger implementation based on Apache Log4J.
+Apache Ignite Log4J module provides IgniteLogger implementation based on Apache Log4J.
 
 To enable Log4J module when starting a standalone node, move 'optional/ignite-log4j' folder to
 'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
index 333b1da..e3828ab 100644
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
@@ -42,7 +42,7 @@ import static org.apache.ignite.IgniteSystemProperties.*;
  * Here is a typical example of configuring log4j logger in Ignite configuration file:
  * <pre name="code" class="xml">
  *      &lt;property name="gridLogger"&gt;
- *          &lt;bean class="org.apache.ignite.grid.logger.log4j.GridLog4jLogger"&gt;
+ *          &lt;bean class="org.apache.ignite.logger.log4j.Log4JLogger"&gt;
  *              &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j.xml"/&gt;
  *          &lt;/bean>
  *      &lt;/property&gt;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/README.txt
----------------------------------------------------------------------
diff --git a/modules/log4j2/README.txt b/modules/log4j2/README.txt
index 2bf9e79..47d01d2 100644
--- a/modules/log4j2/README.txt
+++ b/modules/log4j2/README.txt
@@ -1,7 +1,7 @@
 Apache Ignite Log4J2 Module
 --------------------------
 
-Apache Ignite Log4J2 module provides GridLogger implementation based on Apache Log4J2.
+Apache Ignite Log4J2 module provides IgniteLogger implementation based on Apache Log4J2.
 
 To enable Log4J2 module when starting a standalone node, move 'optional/ignite-log4j2' folder to
 'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j2/pom.xml b/modules/log4j2/pom.xml
index f25a31b..58dc05e 100644
--- a/modules/log4j2/pom.xml
+++ b/modules/log4j2/pom.xml
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+
 <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
@@ -15,35 +16,30 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
 <!--
     POM file.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
+
     <parent>
         <groupId>org.apache.ignite</groupId>
         <artifactId>ignite-parent</artifactId>
         <version>1</version>
         <relativePath>../../parent</relativePath>
     </parent>
+
     <artifactId>ignite-log4j2</artifactId>
-    <version>1.0.6-SNAPSHOT</version>
+    <version>1.4.1-SNAPSHOT</version>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-          <dependency>
-           <groupId>org.apache.logging.log4j</groupId>
-           <artifactId>log4j-api</artifactId>
-           <version>2.3</version>
-         </dependency>
-         <dependency>
-           <groupId>org.apache.logging.log4j</groupId>
-           <artifactId>log4j-core</artifactId>
-           <version>2.3</version>
-         </dependency>
+
         <dependency>
             <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-core</artifactId>
@@ -51,5 +47,17 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>2.3</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>2.3</version>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/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 15ef44d..19f43e6 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
@@ -17,86 +17,64 @@
 
 package org.apache.ignite.logger.log4j2;
 
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.util.GridConcurrentHashSet;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.C1;
-import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteClosure;
-import org.apache.ignite.logger.LoggerNodeIdAware;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.appender.ConsoleAppender;
-import org.apache.logging.log4j.core.appender.FileAppender;
-import org.apache.logging.log4j.core.appender.RollingFileAppender;
-import org.apache.logging.log4j.core.config.AppenderRef;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.Configurator;
-import org.apache.logging.log4j.core.config.LoggerConfig;
-import org.apache.logging.log4j.core.layout.PatternLayout;
-import org.jetbrains.annotations.Nullable;
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.tostring.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.logger.*;
+import org.apache.logging.log4j.*;
+import org.apache.logging.log4j.core.*;
+import org.apache.logging.log4j.core.Logger;
+import org.apache.logging.log4j.core.appender.*;
+import org.apache.logging.log4j.core.appender.routing.*;
+import org.apache.logging.log4j.core.config.*;
+import org.apache.logging.log4j.core.layout.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.nio.charset.*;
+import java.util.*;
+
+import static org.apache.ignite.IgniteSystemProperties.*;
 
 /**
- * Log4j2-based implementation for logging. This logger should be used by
- * loaders that have prefer <a target=_new
- * href="http://logging.apache.org/log4j/2.x/">log4j2</a>-based logging.
+ * Log4j2-based implementation for logging. This logger should be used
+ * by loaders that have prefer <a target=_new href="http://logging.apache.org/log4j/2.x/index.html">log4j2</a>-based logging.
  * <p>
- * Here is a typical example of configuring log4j logger in Ignite configuration
- * file:
- * 
+ * Here is a typical example of configuring log4j2 logger in Ignite configuration file:
  * <pre name="code" class="xml">
  *      &lt;property name="gridLogger"&gt;
- *          &lt;bean class="org.apache.ignite.grid.logger.log4j.GridLog4J2Logger"&gt;
+ *          &lt;bean class="org.apache.ignite.logger.log4j2.Log4J2Logger"&gt;
  *              &lt;constructor-arg type="java.lang.String" value="config/ignite-log4j2.xml"/&gt;
  *          &lt;/bean>
  *      &lt;/property&gt;
  * </pre>
- * 
  * and from your code:
- * 
  * <pre name="code" class="java">
  *      IgniteConfiguration cfg = new IgniteConfiguration();
  *      ...
- *      URL xml = U.resolveIgniteUrl("config/custom-log4j.xml");
+ *      URL xml = U.resolveIgniteUrl("config/custom-log4j2.xml");
  *      IgniteLogger log = new Log4J2Logger(xml);
  *      ...
  *      cfg.setGridLogger(log);
  * </pre>
  *
- * Please take a look at <a target=_new
- * href="http://logging.apache.org/log4j/2.x/">Apache Log4j 2.7</a> for
- * additional information.
+ * Please take a look at <a target=_new href="http://logging.apache.org/log4j/2.x/index.html">Apache Log4j 2</a>
+ * for additional information.
  * <p>
- * It's recommended to use Ignite logger injection instead of
- * using/instantiating logger apacin your task/job code. See
- * {@link org.apache.ignite.resources.LoggerResource} annotation about logger
+ * It's recommended to use Ignite logger injection instead of using/instantiating
+ * logger in your task/job code. See {@link org.apache.ignite.resources.LoggerResource} annotation about logger
  * injection.
- * 
- * Porting for the Log4j2
- * 
- * @author Gianfranco Murador
  */
-public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
-        Log4j2FileAware {
-
-    /** custom message */
-    private static String LOG_MESSAGE = ">>> Local Node [ID: ";
+public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
+    /** */
+    private static final String NODE_ID = "nodeId";
 
-    /** Appenders. */
-    private static Collection<FileAppender> fileAppenders = new GridConcurrentHashSet<>();
+    /** */
+    private static final String CONSOLE_APPENDER = "autoConfiguredIgniteConsoleAppender";
 
     /** */
     private static volatile boolean inited;
@@ -109,104 +87,55 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
 
     /** Logger implementation. */
     @GridToStringExclude
+    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
     private Logger impl;
 
-    /** Path to configuration file. */
-    private final String path;
+    /** Auto added at verbose mode console logger (nullable). */
+    @GridToStringExclude
+    @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
+    private Logger consoleLog;
 
     /** 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 #Log4J2Logger(boolean) Log4J2Logger(boolean)} with parameter
-     * {@code true}, otherwise, existing appenders will be used (analogous to
-     * calling {@link #Log4J2Logger(boolean) Log4J2Logger(boolean)} with
-     * parameter
-     */
-    public Log4J2Logger() {
-        this(!isConfigured());
-    }
+    private volatile UUID nodeId;
 
     /**
      * Creates new logger with given implementation.
-     * 
+     *
      * @param impl Log4j implementation to use.
+     * @param consoleLog Cosole logger (optional).
      */
-    public Log4J2Logger(final Logger impl) {
+    private Log4J2Logger(final Logger impl, @Nullable final Logger consoleLog) {
         assert impl != null;
-
-        path = null;
-
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
-                return impl;
-            }
-        });
+        this.impl = impl;
+        this.consoleLog = consoleLog;
 
         quiet = quiet0;
     }
 
     /**
-     * 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 Log4J2Logger(boolean init) {
-        impl = LogManager.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 configuration {@code cfgFile}.
+     * Creates new logger with given configuration {@code path}.
      *
-     * @param cfgFile Log4j configuration XML file.
+     * @param path Path to log4j configuration XML file.
      * @throws IgniteCheckedException Thrown in case logger can't be created.
      */
-    public Log4J2Logger(File cfgFile) throws IgniteCheckedException {
+    public Log4J2Logger(String path) throws IgniteCheckedException {
+        if (path == null)
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
 
-        final String uri;
+        final URL cfgUrl = U.resolveIgniteUrl(path);
 
-        if (cfgFile == null)
-            throw new IgniteCheckedException(
-                    "Configuration XML file for Log4j must be specified.");
+        if (cfgUrl == null)
+            throw new IgniteCheckedException("Log4j configuration path was not found: " + path);
 
-        if (!cfgFile.exists() || cfgFile.isDirectory())
-            throw new IgniteCheckedException(
-                    "Log4j configuration path was not found or is a directory: "
-                            + cfgFile);
-        try {
-            uri = cfgFile.toURI().toURL().toString();
-        } catch (MalformedURLException e) {
-            throw new IgniteCheckedException(e.toString());
-        }
-        path = cfgFile.getAbsolutePath();
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
-                if (init) {
-                    Configurator.initialize("Log4J2Logger", uri);
-                }
-                return LogManager.getRootLogger();
+        addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    Configurator.initialize(LogManager.ROOT_LOGGER_NAME, cfgUrl.toString());
+
+                return (Logger)LogManager.getRootLogger();
             }
         });
 
@@ -214,31 +143,26 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
     }
 
     /**
-     * Creates new logger with given configuration {@code path}.
-     * @param path Path to log4j configuration XML file.
+     * Creates new logger with given configuration {@code cfgFile}.
+     *
+     * @param cfgFile Log4j configuration XML file.
      * @throws IgniteCheckedException Thrown in case logger can't be created.
      */
-    public Log4J2Logger(String path) throws IgniteCheckedException {
-        if (path == null)
-            throw new IgniteCheckedException(
-                    "Configuration XML file for Log4j must be specified.");
-
-        this.path = path;
+    public Log4J2Logger(File cfgFile) throws IgniteCheckedException {
+        if (cfgFile == null)
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
 
-        final URL cfgUrl = U.resolveIgniteUrl(path);
+        if (!cfgFile.exists() || cfgFile.isDirectory())
+            throw new IgniteCheckedException("Log4j2 configuration path was not found or is a directory: " + cfgFile);
 
-        if (cfgUrl == null)
-            throw new IgniteCheckedException(
-                    "Log4j configuration path was not found: " + path);
+        final String path = cfgFile.getAbsolutePath();
 
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
+        addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    Configurator.initialize(LogManager.ROOT_LOGGER_NAME, path);
 
-                if (init) {
-                    Configurator.initialize("Log4J2Logger", cfgUrl.toString());
-                }
-                return LogManager.getRootLogger();
+                return (Logger)LogManager.getRootLogger();
             }
         });
 
@@ -253,16 +177,14 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
      */
     public Log4J2Logger(final URL cfgUrl) throws IgniteCheckedException {
         if (cfgUrl == null)
-            throw new IgniteCheckedException(
-                    "Configuration XML file for Log4j must be specified.");
-        path = null;
-        addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
-            @Override
-            public Logger apply(Boolean init) {
-                if (init) {
-                    Configurator.initialize("Log4J2Logger", cfgUrl.toString());
-                }
-                return LogManager.getRootLogger();
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
+
+        addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
+            @Override public Logger apply(Boolean init) {
+                if (init)
+                    Configurator.initialize(LogManager.ROOT_LOGGER_NAME, cfgUrl.toString());
+
+                return (Logger)LogManager.getRootLogger();
             }
         });
 
@@ -270,102 +192,124 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
     }
 
     /**
-     * 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 !(LogManager.getLogger("Log4J2Logger") != null);
-    }
-
-    /**
      * Sets level for internal log4j implementation.
      *
      * @param level Log level to set.
      */
     public void setLevel(Level level) {
-        LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+        LoggerContext ctx = (LoggerContext)LogManager.getContext(false);
+
         Configuration conf = ctx.getConfiguration();
-        conf.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(level);
+
+        conf.getLoggerConfig(impl.getName()).setLevel(level);
+
         ctx.updateLoggers(conf);
     }
 
     /** {@inheritDoc} */
-    @Nullable
-    @Override
-    public String fileName() {
-        org.apache.logging.log4j.core.Logger loggerImpl = (org.apache.logging.log4j.core.Logger) impl;
-        Collection<Appender> appenders = loggerImpl.getAppenders().values();
-        for (Appender a : appenders) {
-            if (a instanceof FileAppender) {
-                return ((FileAppender) a).getFileName();
-            }
-            if (a instanceof RollingFileAppender) {
-                return ((RollingFileAppender) a).getFileName();
+    @Nullable @Override public String fileName() {
+        for (Logger log = impl; log != null; log = log.getParent()) {
+            for (Appender a : log.getAppenders().values()) {
+                if (a instanceof FileAppender)
+                    return ((FileAppender)a).getFileName();
+
+                if (a instanceof RollingFileAppender)
+                    return ((RollingFileAppender)a).getFileName();
+
+                if (a instanceof RoutingAppender) {
+                    try {
+                        RoutingAppender routing = (RoutingAppender)a;
+
+                        Field appsFiled = routing.getClass().getDeclaredField("appenders");
+
+                        appsFiled.setAccessible(true);
+
+                        Map<String, AppenderControl> appenders = (Map<String, AppenderControl>)appsFiled.get(routing);
+
+                        for (AppenderControl control : appenders.values()) {
+                            Appender innerApp = control.getAppender();
+
+                            if (innerApp instanceof FileAppender)
+                                return ((FileAppender)innerApp).getFileName();
+
+                            if (innerApp instanceof RollingFileAppender)
+                                return ((RollingFileAppender)innerApp).getFileName();
+                        }
+                    }
+                    catch (IllegalAccessException | NoSuchFieldException e) {
+                        error("Faild to get file name. Looks like the implementation of log4j 2 was changed.", e);
+                    }
+                }
             }
         }
+
         return null;
     }
 
     /**
      * Adds console appender when needed with some default logging settings.
      *
-     * @param logLevel Optional log level.
-     * @param implInitC Optional log implementation init closure.
+     * @param initLogClo Optional log implementation init closure.
      */
-    private void addConsoleAppenderIfNeeded(@Nullable Level logLevel,
-            @Nullable IgniteClosure<Boolean, Logger> implInitC) {
+    private void addConsoleAppenderIfNeeded(@Nullable IgniteClosure<Boolean, Logger> initLogClo) {
         if (inited) {
-            if (implInitC != null)
-                // Do not init.
-                impl = implInitC.apply(false);
+            // Do not init.
+            impl = initLogClo.apply(false);
 
             return;
         }
+
         synchronized (mux) {
             if (inited) {
-                if (implInitC != null)
-                    // Do not init.
-                    impl = implInitC.apply(false);
+                // Do not init.
+                impl = initLogClo.apply(false);
 
                 return;
             }
 
-            if (implInitC != null)
-                // Init logger impl.
-                impl = implInitC.apply(true);
-
-            // use the local quite instead of this
-            boolean quiet = isQuiet();
-
-            // here added a console logger if not exists, programmatically
-            // the implementations is more easy with new API
-            // Log4j2 has always a console logger by default
-            Logger clog = LogManager.getLogger("CONSOLE");
-            if (clog == null) {
-
-                ConsoleAppender console = ConsoleAppender.createAppender(
-                        PatternLayout.createDefaultLayout(), null, "CONSOLE",
-                        "console", null, null);
-                final LoggerContext ctx = (LoggerContext) new org.apache.logging.log4j.core.LoggerContext(
-                        "console");
-
-                final Configuration config = ((org.apache.logging.log4j.core.LoggerContext) ctx)
-                        .getConfiguration();
-                config.addAppender(console);
-                AppenderRef ref = AppenderRef.createAppenderRef("console",
-                        logLevel, null);
-                AppenderRef[] refs = new AppenderRef[] { ref };
-                LoggerConfig loggerConfig = LoggerConfig.createLogger("false",
-                        logLevel, "org.apache.logging.log4j", "true", refs,
-                        null, config, null);
-                loggerConfig.addAppender(console, null, null);
-
-                config.addLogger("org.apache.logging.log4j", loggerConfig);
-                ((org.apache.logging.log4j.core.LoggerContext) ctx)
-                        .updateLoggers();
+            // Init logger impl.
+            impl = initLogClo.apply(true);
+
+            boolean quiet = Boolean.valueOf(System.getProperty(IGNITE_QUIET, "true"));
+
+            boolean consoleAppenderFound = false;
+            Logger rootLogger = null;
+
+            for (Logger log = impl; log != null; ) {
+                if (!consoleAppenderFound) {
+                    for (Appender appender : log.getAppenders().values()) {
+                        if (appender instanceof ConsoleAppender) {
+                            if ("CONSOLE_ERR".equals(appender.getName()))
+                                continue;
+
+                            consoleAppenderFound = true;
+
+                            break;
+                        }
+                    }
+                }
+
+                if (log.getParent() == null) {
+                    rootLogger = log;
+
+                    break;
+                }
+                else
+                    log = log.getParent();
+            }
+
+            if (consoleAppenderFound && quiet)
+                // User configured console appender, but log is quiet.
+                quiet = false;
 
+            if (!consoleAppenderFound && !quiet &&
+                Boolean.valueOf(System.getProperty(IGNITE_CONSOLE_APPENDER, "true"))) {
+                // Console appender not found => we've looked through all categories up to root.
+                assert rootLogger != null;
+
+                // User launched ignite in verbose mode and did not add console appender with INFO level
+                // to configuration and did not set IGNITE_CONSOLE_APPENDER to false.
+                consoleLog = createConsoleLogger();
             }
 
             quiet0 = quiet;
@@ -374,171 +318,169 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware,
     }
 
     /**
-     * With the new Log4j2 API when can choose the filename in the ThreadContext
-     * instead of do some hack to setup the file in according to the nodeid. So
-     * this method is deprecated
+     * Creates console appender with some reasonable default logging settings.
+     *
+     * @return Logger with auto configured console appender.
      */
-    @Override
-    @Deprecated
-    public void updateFilePath(IgniteClosure<String, String> filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-        for (FileAppender a : fileAppenders) {
+    public static Logger createConsoleLogger() {
+        LoggerContext ctx = (LoggerContext)LogManager.getContext(true);
 
-        }
+        Configuration cfg = ctx.getConfiguration();
+
+        PatternLayout layout = PatternLayout.createLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n", null, null,
+            Charset.defaultCharset(), false, false, null, null);
+
+        final Appender consoleApp = ConsoleAppender.createAppender(layout, null, null, CONSOLE_APPENDER, null, null);
+        consoleApp.start();
+
+        AppenderRef ref = AppenderRef.createAppenderRef(CONSOLE_APPENDER, Level.TRACE, null);
+
+        AppenderRef[] refs = {ref};
+
+        LoggerConfig logCfg = LoggerConfig.createLogger("false", Level.INFO, LogManager.ROOT_LOGGER_NAME, "",
+            refs, null, null, null);
+
+        logCfg.addAppender(consoleApp, null, null);
+        cfg.addAppender(consoleApp);
+
+        cfg.addLogger(LogManager.ROOT_LOGGER_NAME, logCfg);
+
+        ctx.updateLoggers(cfg);
+
+        return (Logger)LogManager.getContext().getLogger(LogManager.ROOT_LOGGER_NAME);
     }
 
-    /**
-     * Adds file appender.
-     *
-     * @param a Appender.
-     */
-    public static void addAppender(FileAppender a) {
-        A.notNull(a, "a");
-        fileAppenders.add(a);
+    /** {@inheritDoc} */
+    @Override public void setNodeId(UUID nodeId) {
+        A.notNull(nodeId, "nodeId");
+
+        this.nodeId = nodeId;
+
+        // Set nodeId as system variable to be used at configuration.
+        System.setProperty(NODE_ID, U.id8(nodeId));
+
+        ((LoggerContext)LogManager.getContext(false)).reconfigure();
+    }
+
+    /** {@inheritDoc} */
+    @Override public UUID getNodeId() {
+        return nodeId;
     }
 
     /**
-     * Removes file appender.
+     * Gets {@link 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 a Appender.
+     * @param ctgr {@inheritDoc}
+     * @return {@link IgniteLogger} wrapper around log4j logger.
      */
-    public static void removeAppender(FileAppender a) {
-        A.notNull(a, "a");
-        fileAppenders.remove(a);
+    @Override public Log4J2Logger getLogger(Object ctgr) {
+        if (ctgr == null)
+            return new Log4J2Logger((Logger)LogManager.getRootLogger(),
+                consoleLog == null ? null : (Logger)LogManager.getContext().getLogger(""));
+
+        if (ctgr instanceof Class) {
+            String name = ((Class<?>)ctgr).getName();
+
+            return new Log4J2Logger((Logger)LogManager.getLogger(name),
+                consoleLog == null ? null : (Logger)LogManager.getContext().getLogger(name));
+        }
+
+        String name = ctgr.toString();
+
+        return new Log4J2Logger((Logger)LogManager.getLogger(name),
+            consoleLog == null ? null : (Logger)LogManager.getContext().getLogger(name));
     }
 
     /** {@inheritDoc} */
-    @Override
-    public UUID getNodeId() {
-        return nodeId;
+    @Override public void trace(String msg) {
+        if (!isTraceEnabled())
+            warning("Logging at TRACE level without checking if TRACE level is enabled: " + msg);
+
+        impl.trace(msg);
+
+        if (consoleLog != null)
+            consoleLog.trace(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void setNodeId(UUID nodeid) {
-        A.notNull(nodeid, "nodeId");
-        String uid = U.id8(nodeid);
-
-        // set up the new thread context
-        ThreadContext.put("nodeidmsg", LOG_MESSAGE + uid + "]");
-        ThreadContext.put("ROUTINGKEY", uid);
-
-        ((org.apache.logging.log4j.core.LoggerContext) LogManager
-                .getContext(false)).reconfigure();
-        this.nodeId = nodeid;
+    @Override public void debug(String msg) {
+        if (!isDebugEnabled())
+            warning("Logging at DEBUG level without checking if DEBUG level is enabled: " + msg);
+
+        impl.debug(msg);
+
+        if (consoleLog != null)
+            consoleLog.debug(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);
+    @Override public void info(String msg) {
+        if (!isInfoEnabled())
+            warning("Logging at INFO level without checking if INFO level is enabled: " + msg);
+
+        impl.info(msg);
+
+        if (consoleLog != null)
+            consoleLog.info(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void warning(String msg) {
+    @Override public void warning(String msg) {
         impl.warn(msg);
+
+        if (consoleLog != null)
+            consoleLog.warn(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void warning(String msg, @Nullable Throwable e) {
+    @Override public void warning(String msg, @Nullable Throwable e) {
         impl.warn(msg, e);
+
+        if (consoleLog != null)
+            consoleLog.warn(msg, e);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void error(String msg) {
+    @Override public void error(String msg) {
         impl.error(msg);
-    }
 
-    /** {@inheritDoc} */
-    @Override
-    public void error(String msg, @Nullable Throwable e) {
-        impl.error(msg, e);
+        if (consoleLog != null)
+            consoleLog.error(msg);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public void info(String msg) {
-        if (!impl.isInfoEnabled())
-            warning("Logging at INFO level without checking if INFO level is enabled: "
-                    + msg);
+    @Override public void error(String msg, @Nullable Throwable e) {
+        impl.error(msg, e);
 
-        impl.info(msg);
+        if (consoleLog != null)
+            consoleLog.error(msg, e);
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isTraceEnabled() {
-        return impl.isTraceEnabled();
+    @Override public boolean isTraceEnabled() {
+        return impl.isTraceEnabled() || (consoleLog != null && consoleLog.isTraceEnabled());
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isDebugEnabled() {
-        return impl.isDebugEnabled();
+    @Override public boolean isDebugEnabled() {
+        return impl.isDebugEnabled() || (consoleLog != null && consoleLog.isDebugEnabled());
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isInfoEnabled() {
-        return impl.isInfoEnabled();
+    @Override public boolean isInfoEnabled() {
+        return impl.isInfoEnabled() || (consoleLog != null && consoleLog.isInfoEnabled());
     }
 
     /** {@inheritDoc} */
-    @Override
-    public boolean isQuiet() {
-        return !isInfoEnabled() && !isDebugEnabled();
+    @Override public boolean isQuiet() {
+        return quiet;
     }
 
     /** {@inheritDoc} */
-    @Override
-    public String toString() {
+    @Override public String toString() {
         return S.toString(Log4J2Logger.class, this);
     }
-
-    /**
-     * Gets files for all registered file appenders.
-     *
-     * @return List of files.
-     */
-    public static Collection<String> logFiles() {
-        Collection<String> res = new ArrayList<String>(fileAppenders.size());
-        for (FileAppender a : fileAppenders)
-            res.add(a.getFileName());
-        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 Log4J2Logger getLogger(Object ctgr) {
-        return new Log4J2Logger(
-                ctgr == null ? LogManager.getRootLogger()
-                        : ctgr instanceof Class ? LogManager
-                                .getLogger(((Class<?>) ctgr).getName())
-                                : LogManager.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);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
index 642cf8c..4e18f97 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/package-info.java
@@ -20,4 +20,3 @@
  * Contains <b>default</b> Log4j2 implementation for logging.
  */
 package org.apache.ignite.logger.log4j2;
-

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java
new file mode 100644
index 0000000..ac10a64
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerSelfTest.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.logger.log4j2;
+
+import junit.framework.*;
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.logger.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Grid Log4j2 SPI test.
+ */
+public class Log4j2LoggerSelfTest extends TestCase {
+    /** */
+    private static final String LOG_PATH_TEST = "modules/core/src/test/config/log4j2-test.xml";
+
+    /** */
+    private static final String LOG_PATH_MAIN = "config/ignite-log4j2.xml";
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testFileConstructor() throws Exception {
+        File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_TEST);
+
+        assert xml != null;
+        assert xml.exists();
+
+        IgniteLogger log = new Log4J2Logger(xml).getLogger(getClass());
+
+        ((LoggerNodeIdAware)log).setNodeId(UUID.randomUUID());
+
+        checkLog(log);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testUrlConstructor() throws Exception {
+        File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_TEST);
+
+        assert xml != null;
+        assert xml.exists();
+
+        IgniteLogger log = new Log4J2Logger(xml.toURI().toURL()).getLogger(getClass());
+
+        ((LoggerNodeIdAware)log).setNodeId(UUID.randomUUID());
+
+        checkLog(log);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPathConstructor() throws Exception {
+        IgniteLogger log = new Log4J2Logger(LOG_PATH_TEST).getLogger(getClass());
+
+        ((LoggerNodeIdAware)log).setNodeId(UUID.randomUUID());
+
+        checkLog(log);
+    }
+
+    /**
+     * Tests log4j logging SPI.
+     */
+    private void checkLog(IgniteLogger log) {
+        assert !log.isDebugEnabled();
+        assert log.isInfoEnabled();
+
+        log.debug("This is 'debug' message.");
+        log.info("This is 'info' message.");
+        log.warning("This is 'warning' message.");
+        log.warning("This is 'warning' message.", new Exception("It's a test warning exception"));
+        log.error("This is 'error' message.");
+        log.error("This is 'error' message.", new Exception("It's a test error exception"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSystemNodeId() throws Exception {
+        UUID id = UUID.randomUUID();
+
+        new Log4J2Logger(LOG_PATH_TEST).setNodeId(id);
+
+        assertEquals(U.id8(id), System.getProperty("nodeId"));
+    }
+
+    /**
+     * Tests correct behaviour in case 2 local nodes are started.
+     *
+     * @throws Exception If error occurs.
+     */
+    public void testLogFilesTwoNodes() throws Exception {
+        checkOneNode(0);
+        checkOneNode(1);
+    }
+
+    /**
+     * Starts the local node and checks for presence of log file.
+     * Also checks that this is really a log of a started node.
+     *
+     * @param id Test-local node ID.
+     * @throws Exception If error occurred.
+     */
+    private void checkOneNode(int id) throws Exception {
+        String id8;
+        File logFile;
+
+        try (Ignite ignite = G.start(getConfiguration("grid" + id, LOG_PATH_MAIN))) {
+            id8 = U.id8(ignite.cluster().localNode().id());
+
+            String logPath = "work/log/ignite-" + id8 + ".log";
+
+            logFile = U.resolveIgnitePath(logPath);
+            assertNotNull("Failed to resolve path: " + logPath, logFile);
+            assertTrue("Log file does not exist: " + logFile, logFile.exists());
+
+            assertEquals(logFile.getAbsolutePath(), ignite.log().fileName());
+        }
+
+        String logContent = U.readFileToString(logFile.getAbsolutePath(), "UTF-8");
+
+        assertTrue("Log file does not contain it's node ID: " + logFile,
+            logContent.contains(">>> Local node [ID="+ id8.toUpperCase()));
+
+    }
+
+    /**
+     * Creates grid configuration.
+     *
+     * @param gridName Grid name.
+     * @param logPath Logger configuration path.
+     * @return Grid configuration.
+     * @throws Exception If error occurred.
+     */
+    private static IgniteConfiguration getConfiguration(String gridName, String logPath)
+        throws Exception {
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(new TcpDiscoveryVmIpFinder(false) {{
+            setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
+        }});
+
+        return new IgniteConfiguration()
+            .setGridName(gridName)
+            .setGridLogger(new Log4J2Logger(logPath))
+            .setConnectorConfiguration(null)
+            .setDiscoverySpi(disco);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.java b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.java
new file mode 100644
index 0000000..f4f2356
--- /dev/null
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/Log4j2LoggerVerboseModeSelfTest.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.logger.log4j2;
+
+import junit.framework.*;
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.logging.log4j.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Grid Log4j2 SPI test.
+ */
+public class Log4j2LoggerVerboseModeSelfTest extends TestCase {
+    /** */
+    public static final String LOG_PATH_VERBOSE_TEST = "modules/core/src/test/config/log4j2-verbose-test.xml";
+
+    /**
+     * Test does not work after another tests. Can be run from IDE as separate test.
+     *
+     * @throws Exception If failed.
+     */
+    public void testVerboseMode() throws Exception {
+        final PrintStream backupSysOut = System.out;
+        final PrintStream backupSysErr = System.err;
+
+        final ByteArrayOutputStream testOut = new ByteArrayOutputStream();
+        final ByteArrayOutputStream testErr = new ByteArrayOutputStream();
+
+        try {
+            System.setOut(new PrintStream(testOut));
+            System.setErr(new PrintStream(testErr));
+
+            System.setProperty("IGNITE_QUIET", "false");
+
+            try (Ignite ignite = G.start(getConfiguration("verboseLogGrid", LOG_PATH_VERBOSE_TEST))) {
+                String testMsg = "******* Hello Tester! ******* ";
+
+                ignite.log().error(testMsg + Level.ERROR);
+                ignite.log().warning(testMsg + Level.WARN);
+                ignite.log().info(testMsg + Level.INFO);
+                ignite.log().debug(testMsg + Level.DEBUG);
+                ignite.log().trace(testMsg + Level.TRACE);
+
+                String consoleOut = testOut.toString();
+                String consoleErr = testErr.toString();
+
+                assertTrue(consoleOut.contains(testMsg + Level.INFO));
+                assertTrue(consoleOut.contains(testMsg + Level.DEBUG));
+                assertTrue(consoleOut.contains(testMsg + Level.TRACE));
+                assertTrue(consoleOut.contains(testMsg + Level.ERROR));
+                assertTrue(consoleOut.contains(testMsg + Level.WARN));
+
+                assertTrue(consoleErr.contains(testMsg + Level.ERROR));
+                assertTrue(consoleErr.contains(testMsg + Level.WARN));
+                assertTrue(!consoleErr.contains(testMsg + Level.INFO));
+                assertTrue(consoleErr.contains(testMsg + Level.DEBUG));
+                assertTrue(consoleErr.contains(testMsg + Level.TRACE));
+            }
+        }
+        finally {
+            System.setProperty("IGNITE_QUIET", "true");
+
+            System.setOut(backupSysOut);
+            System.setErr(backupSysErr);
+
+            System.out.println("**************** Out Console content ***************");
+            System.out.println(testOut.toString());
+
+            System.err.println("**************** Err Console content ***************");
+            System.err.println(testErr.toString());
+        }
+    }
+
+    /**
+     * Creates grid configuration.
+     *
+     * @param gridName Grid name.
+     * @param logPath Logger configuration path.
+     * @return Grid configuration.
+     * @throws Exception If error occurred.
+     */
+    private static IgniteConfiguration getConfiguration(String gridName, String logPath)
+        throws Exception {
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(new TcpDiscoveryVmIpFinder(false) {{
+            setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
+        }});
+
+        return new IgniteConfiguration()
+            .setGridName(gridName)
+            .setGridLogger(new Log4J2Logger(logPath))
+            .setConnectorConfiguration(null)
+            .setDiscoverySpi(disco);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/928c5e2c/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
index d025332..85a98c2 100644
--- a/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
+++ b/modules/log4j2/src/test/java/org/apache/ignite/testsuites/IgniteLog4j2TestSuite.java
@@ -17,11 +17,8 @@
 
 package org.apache.ignite.testsuites;
 
-import org.apache.ignite.logger.log4j2.GridLog4j2CorrectFileNameTest;
-import org.apache.ignite.logger.log4j2.GridLog4j2InitializedTest;
-import org.apache.ignite.logger.log4j2.GridLog4j2LoggingFileTest;
-
-import junit.framework.TestSuite;
+import junit.framework.*;
+import org.apache.ignite.logger.log4j2.*;
 
 /**
  * Log4j2 logging tests.
@@ -34,10 +31,8 @@ public class IgniteLog4j2TestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Log4j2 Logging Test Suite");
 
-        suite.addTest(new TestSuite(GridLog4j2InitializedTest.class));
-        suite.addTest(new TestSuite(GridLog4j2CorrectFileNameTest.class));
-        suite.addTest(new TestSuite(GridLog4j2LoggingFileTest.class));
+        suite.addTest(new TestSuite(Log4j2LoggerSelfTest.class));
+
         return suite;
     }
-
 }