ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [01/51] [abbrv] incubator-ignite git commit: sprint-1 - warmup closure cleanup.
Date Sat, 07 Feb 2015 10:52:33 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-96 d0715a6eb -> 08db7f3c5


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
index 0b980b7..dd51939 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithSpecifiedWorkDirectorySelfTest.java
@@ -95,7 +95,7 @@ public class GridStartupWithSpecifiedWorkDirectorySelfTest extends TestCase {
      * @throws Exception If failed.
      */
     public void testStartStopWithUndefinedHomeAndWorkDirs() throws Exception {
-        IgniteLogger log = new IgniteJavaLogger();
+        IgniteLogger log = new JavaLogger();
 
         log.info(">>> Test started: " + getName());
         log.info("Grid start-stop test count: " + GRID_COUNT);
@@ -130,7 +130,7 @@ public class GridStartupWithSpecifiedWorkDirectorySelfTest extends TestCase {
      * @throws Exception If failed.
      */
     public void testStartStopWithUndefinedHomeAndConfiguredWorkDirs() throws Exception {
-        IgniteLogger log = new IgniteJavaLogger();
+        IgniteLogger log = new JavaLogger();
 
         log.info(">>> Test started: " + getName());
         log.info("Grid start-stop test count: " + GRID_COUNT);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
index 36769db..1305e63 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedGridGainHomeSelfTest.java
@@ -72,7 +72,7 @@ public class GridStartupWithUndefinedGridGainHomeSelfTest extends TestCase {
 
         assert ggHome0 == null;
 
-        IgniteLogger log = new IgniteJavaLogger();
+        IgniteLogger log = new JavaLogger();
 
         log.info(">>> Test started: " + getName());
         log.info("Grid start-stop test count: " + GRID_COUNT);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/GgfsSharedMemoryTestClient.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/GgfsSharedMemoryTestClient.java b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/GgfsSharedMemoryTestClient.java
index 1c6fae7..574e41e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/GgfsSharedMemoryTestClient.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/GgfsSharedMemoryTestClient.java
@@ -50,7 +50,7 @@ public class GgfsSharedMemoryTestClient {
 
         try {
             IpcSharedMemoryClientEndpoint client = (IpcSharedMemoryClientEndpoint) IpcEndpointFactory.connectEndpoint(
-                    "shmem:" + IpcSharedMemoryServerEndpoint.DFLT_IPC_PORT, new IgniteJavaLogger());
+                    "shmem:" + IpcSharedMemoryServerEndpoint.DFLT_IPC_PORT, new JavaLogger());
 
             os = client.outputStream();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryFakeClient.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryFakeClient.java b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryFakeClient.java
index 2e1f73e..2c4b82e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryFakeClient.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryFakeClient.java
@@ -29,8 +29,8 @@ public class IpcSharedMemoryFakeClient {
      * @throws Exception If failed.
      */
     public static void main(String[] args) throws Exception{
-        IpcEndpointFactory.connectEndpoint("shmem:10500", new IgniteJavaLogger());
-        IpcEndpointFactory.connectEndpoint("shmem:10500", new IgniteJavaLogger());
-        IpcEndpointFactory.connectEndpoint("shmem:10500", new IgniteJavaLogger());
+        IpcEndpointFactory.connectEndpoint("shmem:10500", new JavaLogger());
+        IpcEndpointFactory.connectEndpoint("shmem:10500", new JavaLogger());
+        IpcEndpointFactory.connectEndpoint("shmem:10500", new JavaLogger());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/benchmark/IpcSharedMemoryBenchmarkWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/benchmark/IpcSharedMemoryBenchmarkWriter.java b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/benchmark/IpcSharedMemoryBenchmarkWriter.java
index fe2374a..2ade145 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/benchmark/IpcSharedMemoryBenchmarkWriter.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/benchmark/IpcSharedMemoryBenchmarkWriter.java
@@ -84,7 +84,7 @@ public class IpcSharedMemoryBenchmarkWriter implements IpcSharedMemoryBenchmarkP
 
                     try {
                         client = IpcEndpointFactory.connectEndpoint("shmem:" +
-                                IpcSharedMemoryServerEndpoint.DFLT_IPC_PORT, new IgniteJavaLogger());
+                                IpcSharedMemoryServerEndpoint.DFLT_IPC_PORT, new JavaLogger());
 
                         OutputStream space = client.outputStream();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/logger/java/GridJavaLoggerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/logger/java/GridJavaLoggerTest.java b/modules/core/src/test/java/org/apache/ignite/logger/java/GridJavaLoggerTest.java
index e10a264..14a01f0 100644
--- a/modules/core/src/test/java/org/apache/ignite/logger/java/GridJavaLoggerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/logger/java/GridJavaLoggerTest.java
@@ -40,9 +40,9 @@ public class GridJavaLoggerTest extends TestCase {
     public void testLogInitialize() throws Exception {
         U.setWorkDirectory(null, U.getGridGainHome());
 
-        log = new IgniteJavaLogger();
+        log = new JavaLogger();
 
-        ((IgniteLoggerNodeIdAware)log).setNodeId(UUID.fromString("00000000-1111-2222-3333-444444444444"));
+        ((LoggerNodeIdAware)log).setNodeId(UUID.fromString("00000000-1111-2222-3333-444444444444"));
 
         if (log.isDebugEnabled())
             log.debug("This is 'debug' message.");
@@ -55,7 +55,7 @@ public class GridJavaLoggerTest 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(GridJavaLoggerTest.class.getName()) instanceof IgniteJavaLogger;
+        assert log.getLogger(GridJavaLoggerTest.class.getName()) instanceof JavaLogger;
 
         assert log.fileName() != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
index 358d7b9..87727e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerResourceBean.java
@@ -65,7 +65,7 @@ class GridMarshallerResourceBean implements Serializable {
      * Initialization.
      */
     GridMarshallerResourceBean() {
-        log = new IgniteJavaLogger();
+        log = new JavaLogger();
         marshaller = new IgniteJdkMarshaller();
         mbeanSrv = ManagementFactory.getPlatformMBeanServer();
         ses = new GridTestTaskSession();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridLog4jRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridLog4jRollingFileAppender.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridLog4jRollingFileAppender.java
index 16da0d5..9809ae9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridLog4jRollingFileAppender.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridLog4jRollingFileAppender.java
@@ -28,7 +28,7 @@ import java.util.*;
 /**
  * Log4J {@link org.apache.log4j.RollingFileAppender} with added support for grid node IDs.
  */
-public class GridLog4jRollingFileAppender extends RollingFileAppender implements IgniteLoggerNodeIdAware {
+public class GridLog4jRollingFileAppender extends RollingFileAppender implements LoggerNodeIdAware {
     /** Node ID. */
     private UUID nodeId;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
index 0629262..6b591ae 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
@@ -64,7 +64,7 @@ import static org.apache.ignite.IgniteSystemProperties.*;
  * logger in your task/job code. See {@link org.apache.ignite.resources.IgniteLoggerResource} annotation about logger
  * injection.
  */
-public class GridTestLog4jLogger implements IgniteLogger, IgniteLoggerNodeIdAware {
+public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -401,8 +401,8 @@ public class GridTestLog4jLogger implements IgniteLogger, IgniteLoggerNodeIdAwar
         this.nodeId = nodeId;
 
         for (FileAppender a : fileAppenders) {
-            if (a instanceof IgniteLoggerNodeIdAware) {
-                ((IgniteLoggerNodeIdAware)a).setNodeId(nodeId);
+            if (a instanceof LoggerNodeIdAware) {
+                ((LoggerNodeIdAware)a).setNodeId(nodeId);
 
                 a.activateOptions();
             }

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/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
index 9ddb299..eb9bee6 100644
--- 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
@@ -55,7 +55,7 @@ public class IgniteLog4jDailyRollingFileAppender extends DailyRollingFileAppende
      *
      */
     private void init() {
-        IgniteLog4jLogger.addAppender(this);
+        Log4JLogger.addAppender(this);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/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
index c66d638..39dc0f9 100644
--- 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
@@ -41,7 +41,7 @@ public class IgniteLog4jExternallyRolledFileAppender extends ExternallyRolledFil
      *
      */
     private void init() {
-        IgniteLog4jLogger.addAppender(this);
+        Log4JLogger.addAppender(this);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/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
index 95ab9c4..ea39024 100644
--- 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
@@ -85,7 +85,7 @@ public class IgniteLog4jFileAppender extends FileAppender implements IgniteLog4j
      *
      */
     private void init() {
-        IgniteLog4jLogger.addAppender(this);
+        Log4JLogger.addAppender(this);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/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
deleted file mode 100644
index 7deb111..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jLogger.java
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- * 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.log4j;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.util.*;
-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.log4j.*;
-import org.apache.log4j.varia.*;
-import org.apache.log4j.xml.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import static org.apache.ignite.IgniteSystemProperties.*;
-
-/**
- * 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/ignite-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 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 IgniteCheckedException Thrown in case logger can't be created.
-     */
-    public IgniteLog4jLogger(String path) throws IgniteCheckedException {
-        if (path == null)
-            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
-
-        this.path = path;
-
-        final URL cfgUrl = U.resolveGridGainUrl(path);
-
-        if (cfgUrl == null)
-            throw new IgniteCheckedException("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 IgniteCheckedException Thrown in case logger can't be created.
-     */
-    public IgniteLog4jLogger(File cfgFile) throws IgniteCheckedException {
-        if (cfgFile == null)
-            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
-
-        if (!cfgFile.exists() || cfgFile.isDirectory())
-            throw new IgniteCheckedException("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 IgniteCheckedException Thrown in case logger can't be created.
-     */
-    public IgniteLog4jLogger(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)
-                    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(IGNITE_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(IGNITE_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 IGNITE_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/5fa6d5cb/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
index 28aa4d0..3ccda1a 100644
--- 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
@@ -68,7 +68,7 @@ public class IgniteLog4jRollingFileAppender extends RollingFileAppender implemen
      * Initializes appender.
      */
     private void init() {
-        IgniteLog4jLogger.addAppender(this);
+        Log4JLogger.addAppender(this);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/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
new file mode 100644
index 0000000..6169470
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
@@ -0,0 +1,522 @@
+/*
+ * 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.log4j;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.util.*;
+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.log4j.*;
+import org.apache.log4j.varia.*;
+import org.apache.log4j.xml.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import static org.apache.ignite.IgniteSystemProperties.*;
+
+/**
+ * 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/ignite-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 Log4JLogger implements IgniteLogger, LoggerNodeIdAware,
+    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 #Log4JLogger(boolean) GridLog4jLogger(boolean)}
+     * with parameter {@code true}, otherwise, existing appenders will be used (analogous
+     * to calling {@link #Log4JLogger(boolean) GridLog4jLogger(boolean)}
+     * with parameter {@code false}).
+     */
+    public Log4JLogger() {
+        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 Log4JLogger(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 Log4JLogger(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 IgniteCheckedException Thrown in case logger can't be created.
+     */
+    public Log4JLogger(String path) throws IgniteCheckedException {
+        if (path == null)
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
+
+        this.path = path;
+
+        final URL cfgUrl = U.resolveGridGainUrl(path);
+
+        if (cfgUrl == null)
+            throw new IgniteCheckedException("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 IgniteCheckedException Thrown in case logger can't be created.
+     */
+    public Log4JLogger(File cfgFile) throws IgniteCheckedException {
+        if (cfgFile == null)
+            throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");
+
+        if (!cfgFile.exists() || cfgFile.isDirectory())
+            throw new IgniteCheckedException("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 IgniteCheckedException Thrown in case logger can't be created.
+     */
+    public Log4JLogger(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)
+                    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(IGNITE_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(IGNITE_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 IGNITE_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 Log4JLogger getLogger(Object ctgr) {
+        return new Log4JLogger(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(Log4JLogger.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/5fa6d5cb/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
index 7f33f90..22e40cd 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
@@ -56,7 +56,7 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
         if (appender != null) {
             Logger.getRootLogger().removeAppender(IgniteLog4jRollingFileAppender.class.getSimpleName());
 
-            IgniteLog4jLogger.removeAppender(appender);
+            Log4JLogger.removeAppender(appender);
         }
     }
 
@@ -104,7 +104,7 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
         IgniteConfiguration cfg = new IgniteConfiguration();
 
         cfg.setGridName(gridName);
-        cfg.setGridLogger(new IgniteLog4jLogger());
+        cfg.setGridLogger(new Log4JLogger());
         cfg.setRestEnabled(false);
 
         return cfg;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jInitializedTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jInitializedTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jInitializedTest.java
index 3f7bc55..80e86f1 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jInitializedTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jInitializedTest.java
@@ -37,7 +37,7 @@ public class GridLog4jInitializedTest extends TestCase {
 
     /** */
     public void testLogInitialize() {
-        IgniteLogger log = new IgniteLog4jLogger();
+        IgniteLogger log = new Log4JLogger();
 
         assert log.isInfoEnabled() == true;
 
@@ -50,6 +50,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 IgniteLog4jLogger;
+        assert log.getLogger(GridLog4jInitializedTest.class.getName()) instanceof Log4JLogger;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingFileTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingFileTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingFileTest.java
index 0bb6abd..9d3fd55 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingFileTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingFileTest.java
@@ -39,7 +39,7 @@ public class GridLog4jLoggingFileTest extends TestCase {
         assert xml != null;
         assert xml.exists() == true;
 
-        log = new IgniteLog4jLogger(xml).getLogger(getClass());
+        log = new Log4JLogger(xml).getLogger(getClass());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingPathTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingPathTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingPathTest.java
index 996a338..c0f5096 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingPathTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingPathTest.java
@@ -31,7 +31,7 @@ public class GridLog4jLoggingPathTest extends TestCase {
 
     /** {@inheritDoc} */
     @Override protected void setUp() throws Exception {
-        log = new IgniteLog4jLogger("modules/core/src/test/config/log4j-test.xml").getLogger(getClass());
+        log = new Log4JLogger("modules/core/src/test/config/log4j-test.xml").getLogger(getClass());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingUrlTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingUrlTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingUrlTest.java
index 748ded9..06ccd7e 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingUrlTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jLoggingUrlTest.java
@@ -39,7 +39,7 @@ public class GridLog4jLoggingUrlTest extends TestCase {
         assert xml != null;
         assert xml.exists();
 
-        log = new IgniteLog4jLogger(xml.toURI().toURL()).getLogger(getClass());
+        log = new Log4JLogger(xml.toURI().toURL()).getLogger(getClass());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5fa6d5cb/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jNotInitializedTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jNotInitializedTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jNotInitializedTest.java
index 4026d03..508ea25 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jNotInitializedTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jNotInitializedTest.java
@@ -28,7 +28,7 @@ import org.apache.ignite.testframework.junits.common.*;
 public class GridLog4jNotInitializedTest extends TestCase {
     /** */
     public void testLogInitialize() {
-        IgniteLogger log = new IgniteLog4jLogger().getLogger(GridLog4jNotInitializedTest.class);
+        IgniteLogger log = new Log4JLogger().getLogger(GridLog4jNotInitializedTest.class);
 
         if (log.isDebugEnabled())
             log.debug("This is 'debug' message.");


Mime
View raw message