ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [04/20] incubator-ignite git commit: # ignite-240 Fixed missing links in Javadoc.
Date Fri, 13 Feb 2015 12:30:24 GMT
# ignite-240 Fixed missing links in Javadoc.


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

Branch: refs/heads/ignite-236
Commit: 6bdb192a903c46de5cf900b57373932d8b16c949
Parents: 43a7391
Author: anovikov <anovikov@gridgain.com>
Authored: Fri Feb 13 13:06:19 2015 +0700
Committer: anovikov <anovikov@gridgain.com>
Committed: Fri Feb 13 13:06:19 2015 +0700

----------------------------------------------------------------------
 config/ignite-log4j.xml                         |   2 +-
 .../configuration/IgniteConfiguration.java      |   2 +-
 .../optimized/optimized-classnames.properties   |   2 +-
 .../discovery/tcp/TcpDiscoverySpiAdapter.java   |   2 +-
 .../IgniteLog4jDailyRollingFileAppender.java    |  77 -------------
 ...IgniteLog4jExternallyRolledFileAppender.java |  63 -----------
 .../logger/log4j/IgniteLog4jFileAppender.java   | 107 -------------------
 .../logger/log4j/IgniteLog4jFileAware.java      |  32 ------
 .../logger/log4j/IgniteLog4jNodeIdFilePath.java |  64 -----------
 .../log4j/IgniteLog4jRollingFileAppender.java   |  90 ----------------
 .../log4j/Log4JDailyRollingFileAppender.java    |  77 +++++++++++++
 .../Log4JExternallyRolledFileAppender.java      |  63 +++++++++++
 .../ignite/logger/log4j/Log4JFileAppender.java  | 107 +++++++++++++++++++
 .../apache/ignite/logger/log4j/Log4JLogger.java |   9 +-
 .../ignite/logger/log4j/Log4jFileAware.java     |  32 ++++++
 .../logger/log4j/Log4jNodeIdFilePath.java       |  64 +++++++++++
 .../logger/log4j/Log4jRollingFileAppender.java  |  90 ++++++++++++++++
 .../log4j/GridLog4jCorrectFileNameTest.java     |  12 +--
 18 files changed, 447 insertions(+), 448 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/config/ignite-log4j.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j.xml b/config/ignite-log4j.xml
index 292e91f..20b4a4e 100644
--- a/config/ignite-log4j.xml
+++ b/config/ignite-log4j.xml
@@ -67,7 +67,7 @@
         Logs all output to specified file.
         By default, the logging goes to IGNITE_HOME/work/log folder
     -->
-    <appender name="FILE" class="org.apache.ignite.logger.log4j.IgniteLog4jFileAppender">
+    <appender name="FILE" class="org.apache.ignite.logger.log4j.Log4JFileAppender">
         <param name="Threshold" value="DEBUG"/>
         <param name="File" value="${IGNITE_HOME}/work/log/ignite.log"/>
         <param name="Append" value="true"/>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 95e0a0f..c7a200a 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -922,7 +922,7 @@ public class IgniteConfiguration {
 
     /**
      * Should return an instance of logger to use in grid. If not provided,
-     * {@ignitelink org.apache.ignite.logger.log4j.IgniteLog4jLogger}
+     * {@ignitelink org.apache.ignite.logger.log4j.Log4jLogger}
      * will be used.
      *
      * @return Logger to use in grid.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
index 4ff4f55..2e48000 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
@@ -1519,7 +1519,7 @@ org.apache.ignite.lang.IgniteFutureTimeoutException
 org.apache.ignite.lang.IgniteProductVersion
 org.apache.ignite.lang.IgniteUuid
 org.apache.ignite.lifecycle.LifecycleEventType
-org.apache.ignite.logger.log4j.IgniteLog4jNodeIdFilePath
+org.apache.ignite.logger.log4j.Log4jNodeIdFilePath
 org.apache.ignite.logger.log4j.Log4JLogger$1
 org.apache.ignite.logger.log4j.Log4JLogger$2
 org.apache.ignite.logger.log4j.Log4JLogger$3

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index 159b277..3a59f82 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -848,7 +848,7 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements
Discov
     /**
      * Socket timeout object.
      */
-    protected static class SocketTimeoutObject {
+    private static class SocketTimeoutObject {
         /** */
         private static final AtomicLong idGen = new AtomicLong();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/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
deleted file mode 100644
index eb9bee6..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jDailyRollingFileAppender.java
+++ /dev/null
@@ -1,77 +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.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.apache.log4j.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link DailyRollingFileAppender} with added support for grid node IDs.
- */
-public class IgniteLog4jDailyRollingFileAppender extends DailyRollingFileAppender implements
IgniteLog4jFileAware {
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public IgniteLog4jDailyRollingFileAppender() {
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param datePtrn Date pattern.
-     * @throws IOException If failed.
-     */
-    public IgniteLog4jDailyRollingFileAppender(Layout layout, String filename, String datePtrn)
throws IOException {
-        super(layout, filename, datePtrn);
-
-        init();
-    }
-
-    /**
-     *
-     */
-    private void init() {
-        Log4JLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/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
deleted file mode 100644
index 39dc0f9..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jExternallyRolledFileAppender.java
+++ /dev/null
@@ -1,63 +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.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.apache.log4j.varia.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link ExternallyRolledFileAppender} with added support for grid node IDs.
- */
-public class IgniteLog4jExternallyRolledFileAppender extends ExternallyRolledFileAppender
implements IgniteLog4jFileAware {
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public IgniteLog4jExternallyRolledFileAppender() {
-        init();
-    }
-
-    /**
-     *
-     */
-    private void init() {
-        Log4JLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/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
deleted file mode 100644
index ea39024..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAppender.java
+++ /dev/null
@@ -1,107 +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.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.apache.log4j.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link FileAppender} with added support for grid node IDs.
- */
-public class IgniteLog4jFileAppender extends FileAppender implements IgniteLog4jFileAware
{
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public IgniteLog4jFileAppender() {
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @throws IOException If failed.
-     */
-    public IgniteLog4jFileAppender(Layout layout, String filename) throws IOException {
-        super(layout, filename);
-
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param append Append flag.
-     * @throws IOException If failed.
-     */
-    public IgniteLog4jFileAppender(Layout layout, String filename, boolean append) throws
IOException {
-        super(layout, filename, append);
-
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param append Append flag.
-     * @param bufIO Buffered IO flag.
-     * @param bufSize Buffer size.
-     * @throws IOException If failed.
-     */
-    public IgniteLog4jFileAppender(Layout layout, String filename, boolean append, boolean
bufIO, int bufSize)
-        throws IOException {
-        super(layout, filename, append, bufIO, bufSize);
-
-        init();
-    }
-
-    /**
-     *
-     */
-    private void init() {
-        Log4JLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java
deleted file mode 100644
index 1aebb86..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jFileAware.java
+++ /dev/null
@@ -1,32 +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.lang.*;
-
-/**
- * Interface for those loggers and appenders that evaluate their file paths lazily.
- */
-interface IgniteLog4jFileAware {
-    /**
-     * Sets closure that later evaluate file path.
-     *
-     * @param filePathClos Closure that generates actual file path.
-     */
-    void updateFilePath(IgniteClosure<String, String> filePathClos);
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java
deleted file mode 100644
index 0ea6878..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jNodeIdFilePath.java
+++ /dev/null
@@ -1,64 +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.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Closure that generates file path adding node id to filename as a suffix.
- */
-class IgniteLog4jNodeIdFilePath implements IgniteClosure<String, String> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Node id. */
-    private final UUID nodeId;
-
-    /**
-     * Creates new instance.
-     *
-     * @param id Node id.
-     */
-    IgniteLog4jNodeIdFilePath(UUID id) {
-        nodeId = id;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String apply(String oldPath) {
-        if (!F.isEmpty(U.IGNITE_LOG_DIR))
-            return U.nodeIdLogFileName(nodeId, new File(U.IGNITE_LOG_DIR, "ignite.log").getAbsolutePath());
-
-        if (oldPath != null) // fileName could be null if IGNITE_HOME is not defined.
-            return U.nodeIdLogFileName(nodeId, oldPath);
-
-        String tmpDir = IgniteSystemProperties.getString("java.io.tmpdir");
-
-        if (tmpDir != null)
-            return U.nodeIdLogFileName(nodeId, new File(tmpDir, "ignite.log").getAbsolutePath());
-
-        System.err.println("Failed to get tmp directory for log file.");
-
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/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
deleted file mode 100644
index 3ccda1a..0000000
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/IgniteLog4jRollingFileAppender.java
+++ /dev/null
@@ -1,90 +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.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.apache.log4j.*;
-
-import java.io.*;
-
-/**
- * Log4J {@link RollingFileAppender} with added support for grid node IDs.
- */
-public class IgniteLog4jRollingFileAppender extends RollingFileAppender implements IgniteLog4jFileAware
{
-    /** Basic log file name. */
-    private String baseFileName;
-
-    /**
-     * Default constructor (does not do anything).
-     */
-    public IgniteLog4jRollingFileAppender() {
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @throws IOException If failed.
-     */
-    public IgniteLog4jRollingFileAppender(Layout layout, String filename) throws IOException
{
-        super(layout, filename);
-
-        init();
-    }
-
-    /**
-     * Instantiate a FileAppender with given parameters.
-     *
-     * @param layout Layout.
-     * @param filename File name.
-     * @param append Append flag.
-     * @throws IOException If failed.
-     */
-    public IgniteLog4jRollingFileAppender(Layout layout, String filename, boolean append)
throws IOException {
-        super(layout, filename, append);
-
-        init();
-    }
-
-    /**
-     * Initializes appender.
-     */
-    private void init() {
-        Log4JLogger.addAppender(this);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
-        A.notNull(filePathClos, "filePathClos");
-
-        if (baseFileName == null)
-            baseFileName = fileName;
-
-        fileName = filePathClos.apply(baseFileName);
-    }
-
-    /** {@inheritDoc} */
-    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
-        throws IOException {
-        if (baseFileName != null)
-            super.setFile(fileName, fileAppend, bufIO, bufSize);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JDailyRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JDailyRollingFileAppender.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JDailyRollingFileAppender.java
new file mode 100644
index 0000000..c9053c6
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JDailyRollingFileAppender.java
@@ -0,0 +1,77 @@
+/*
+ * 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.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.log4j.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link DailyRollingFileAppender} with added support for grid node IDs.
+ */
+public class Log4JDailyRollingFileAppender extends DailyRollingFileAppender implements Log4jFileAware
{
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public Log4JDailyRollingFileAppender() {
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param datePtrn Date pattern.
+     * @throws IOException If failed.
+     */
+    public Log4JDailyRollingFileAppender(Layout layout, String filename, String datePtrn)
throws IOException {
+        super(layout, filename, datePtrn);
+
+        init();
+    }
+
+    /**
+     *
+     */
+    private void init() {
+        Log4JLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JExternallyRolledFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JExternallyRolledFileAppender.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JExternallyRolledFileAppender.java
new file mode 100644
index 0000000..42d6378
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JExternallyRolledFileAppender.java
@@ -0,0 +1,63 @@
+/*
+ * 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.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.log4j.varia.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link ExternallyRolledFileAppender} with added support for grid node IDs.
+ */
+public class Log4JExternallyRolledFileAppender extends ExternallyRolledFileAppender implements
Log4jFileAware {
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public Log4JExternallyRolledFileAppender() {
+        init();
+    }
+
+    /**
+     *
+     */
+    private void init() {
+        Log4JLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JFileAppender.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JFileAppender.java
new file mode 100644
index 0000000..f628f82
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JFileAppender.java
@@ -0,0 +1,107 @@
+/*
+ * 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.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.log4j.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link FileAppender} with added support for grid node IDs.
+ */
+public class Log4JFileAppender extends FileAppender implements Log4jFileAware {
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public Log4JFileAppender() {
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @throws IOException If failed.
+     */
+    public Log4JFileAppender(Layout layout, String filename) throws IOException {
+        super(layout, filename);
+
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param append Append flag.
+     * @throws IOException If failed.
+     */
+    public Log4JFileAppender(Layout layout, String filename, boolean append) throws IOException
{
+        super(layout, filename, append);
+
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param append Append flag.
+     * @param bufIO Buffered IO flag.
+     * @param bufSize Buffer size.
+     * @throws IOException If failed.
+     */
+    public Log4JFileAppender(Layout layout, String filename, boolean append, boolean bufIO,
int bufSize)
+        throws IOException {
+        super(layout, filename, append, bufIO, bufSize);
+
+        init();
+    }
+
+    /**
+     *
+     */
+    private void init() {
+        Log4JLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/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 561acd4..611884f 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
@@ -64,8 +64,7 @@ import static org.apache.ignite.IgniteSystemProperties.*;
  * logger in your task/job code. See {@link org.apache.ignite.resources.LoggerResource} annotation
about logger
  * injection.
  */
-public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware,
-    IgniteLog4jFileAware {
+public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware, Log4jFileAware {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -401,7 +400,7 @@ public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware,
 
         this.nodeId = nodeId;
 
-        updateFilePath(new IgniteLog4jNodeIdFilePath(nodeId));
+        updateFilePath(new Log4jNodeIdFilePath(nodeId));
     }
 
     /** {@inheritDoc} */
@@ -512,8 +511,8 @@ public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware,
         A.notNull(filePathClos, "filePathClos");
 
         for (FileAppender a : fileAppenders) {
-            if (a instanceof IgniteLog4jFileAware) {
-                ((IgniteLog4jFileAware)a).updateFilePath(filePathClos);
+            if (a instanceof Log4jFileAware) {
+                ((Log4jFileAware)a).updateFilePath(filePathClos);
 
                 a.activateOptions();
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jFileAware.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jFileAware.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jFileAware.java
new file mode 100644
index 0000000..4f2a668
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jFileAware.java
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.*;
+
+/**
+ * Interface for those loggers and appenders that evaluate their file paths lazily.
+ */
+interface Log4jFileAware {
+    /**
+     * Sets closure that later evaluate file path.
+     *
+     * @param filePathClos Closure that generates actual file path.
+     */
+    void updateFilePath(IgniteClosure<String, String> filePathClos);
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jNodeIdFilePath.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jNodeIdFilePath.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jNodeIdFilePath.java
new file mode 100644
index 0000000..8c4b98b
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jNodeIdFilePath.java
@@ -0,0 +1,64 @@
+/*
+ * 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.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Closure that generates file path adding node id to filename as a suffix.
+ */
+class Log4jNodeIdFilePath implements IgniteClosure<String, String> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Node id. */
+    private final UUID nodeId;
+
+    /**
+     * Creates new instance.
+     *
+     * @param id Node id.
+     */
+    Log4jNodeIdFilePath(UUID id) {
+        nodeId = id;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String apply(String oldPath) {
+        if (!F.isEmpty(U.IGNITE_LOG_DIR))
+            return U.nodeIdLogFileName(nodeId, new File(U.IGNITE_LOG_DIR, "ignite.log").getAbsolutePath());
+
+        if (oldPath != null) // fileName could be null if IGNITE_HOME is not defined.
+            return U.nodeIdLogFileName(nodeId, oldPath);
+
+        String tmpDir = IgniteSystemProperties.getString("java.io.tmpdir");
+
+        if (tmpDir != null)
+            return U.nodeIdLogFileName(nodeId, new File(tmpDir, "ignite.log").getAbsolutePath());
+
+        System.err.println("Failed to get tmp directory for log file.");
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jRollingFileAppender.java
b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jRollingFileAppender.java
new file mode 100644
index 0000000..dcf03a4
--- /dev/null
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4jRollingFileAppender.java
@@ -0,0 +1,90 @@
+/*
+ * 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.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import org.apache.log4j.*;
+
+import java.io.*;
+
+/**
+ * Log4J {@link RollingFileAppender} with added support for grid node IDs.
+ */
+public class Log4jRollingFileAppender extends RollingFileAppender implements Log4jFileAware
{
+    /** Basic log file name. */
+    private String baseFileName;
+
+    /**
+     * Default constructor (does not do anything).
+     */
+    public Log4jRollingFileAppender() {
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @throws IOException If failed.
+     */
+    public Log4jRollingFileAppender(Layout layout, String filename) throws IOException {
+        super(layout, filename);
+
+        init();
+    }
+
+    /**
+     * Instantiate a FileAppender with given parameters.
+     *
+     * @param layout Layout.
+     * @param filename File name.
+     * @param append Append flag.
+     * @throws IOException If failed.
+     */
+    public Log4jRollingFileAppender(Layout layout, String filename, boolean append) throws
IOException {
+        super(layout, filename, append);
+
+        init();
+    }
+
+    /**
+     * Initializes appender.
+     */
+    private void init() {
+        Log4JLogger.addAppender(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void updateFilePath(IgniteClosure<String, String>
filePathClos) {
+        A.notNull(filePathClos, "filePathClos");
+
+        if (baseFileName == null)
+            baseFileName = fileName;
+
+        fileName = filePathClos.apply(baseFileName);
+    }
+
+    /** {@inheritDoc} */
+    @Override public synchronized void setFile(String fileName, boolean fileAppend, boolean
bufIO, int bufSize)
+        throws IOException {
+        if (baseFileName != null)
+            super.setFile(fileName, fileAppend, bufIO, bufSize);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6bdb192a/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 3676f4e..0aef8f6 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
@@ -35,14 +35,14 @@ import java.util.*;
 @GridCommonTest(group = "Logger")
 public class GridLog4jCorrectFileNameTest extends TestCase {
     /** Appender */
-    private IgniteLog4jRollingFileAppender appender;
+    private Log4jRollingFileAppender appender;
 
     /** {@inheritDoc} */
     @Override protected void setUp() throws Exception {
         Logger root = Logger.getRootLogger();
 
         for (Enumeration appenders = root.getAllAppenders(); appenders.hasMoreElements();
) {
-            if (appenders.nextElement() instanceof IgniteLog4jRollingFileAppender)
+            if (appenders.nextElement() instanceof Log4jRollingFileAppender)
                 return;
         }
 
@@ -54,7 +54,7 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
     /** {@inheritDoc} */
     @Override public void tearDown() {
         if (appender != null) {
-            Logger.getRootLogger().removeAppender(IgniteLog4jRollingFileAppender.class.getSimpleName());
+            Logger.getRootLogger().removeAppender(Log4jRollingFileAppender.class.getSimpleName());
 
             Log4JLogger.removeAppender(appender);
         }
@@ -116,12 +116,12 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
      * @return GridLog4jRollingFileAppender.
      * @throws Exception If error occurred.
      */
-    private static IgniteLog4jRollingFileAppender createAppender() throws Exception {
-        IgniteLog4jRollingFileAppender appender = new IgniteLog4jRollingFileAppender();
+    private static Log4jRollingFileAppender createAppender() throws Exception {
+        Log4jRollingFileAppender appender = new Log4jRollingFileAppender();
 
         appender.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
         appender.setFile("work/log/ignite.log");
-        appender.setName(IgniteLog4jRollingFileAppender.class.getSimpleName());
+        appender.setName(Log4jRollingFileAppender.class.getSimpleName());
 
         LevelRangeFilter lvlFilter = new LevelRangeFilter();
 


Mime
View raw message