ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [2/3] incubator-ignite git commit: # ignite-788: self-review 2
Date Mon, 20 Jul 2015 16:29:55 GMT
# ignite-788: self-review 2


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

Branch: refs/heads/ignite-788-last-review
Commit: bf2f61e9199ea891d098205dd81d9559c49a8cb6
Parents: bcf30a0
Author: ashutak <ashutak@gridgain.com>
Authored: Mon Jul 20 19:21:46 2015 +0300
Committer: ashutak <ashutak@gridgain.com>
Committed: Mon Jul 20 19:21:46 2015 +0300

----------------------------------------------------------------------
 assembly/release-base.xml                       |  5 +++++
 config/ignite-log4j2.xml                        |  4 ++--
 .../apache/ignite/logger/log4j/Log4JLogger.java |  2 +-
 .../ignite/logger/log4j2/Log4J2Logger.java      | 21 +++++---------------
 .../logger/log4j2/GridLog4j2SelfTest.java       | 10 ++++------
 5 files changed, 17 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf2f61e9/config/ignite-log4j2.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml b/config/ignite-log4j2.xml
index 9258258..c9c349e 100644
--- a/config/ignite-log4j2.xml
+++ b/config/ignite-log4j2.xml
@@ -21,7 +21,7 @@
     <Appenders>
         <Console name="CONSOLE" target="SYSTEM_OUT">
             <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
-            <ThresholdFilter level="WARN" onMatch="DENY" onMismatch="ACCEPT"/>
+            <ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
         </Console>
 
         <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
@@ -74,7 +74,7 @@
             <AppenderRef ref="CONSOLE" level="DEBUG"/>
             -->
 
-            <AppenderRef ref="CONSOLE_ERR" level="WARN"/>
+            <AppenderRef ref="CONSOLE_ERR" level="ERROR"/>
             <AppenderRef ref="FILE" level="DEBUG"/>
         </Root>
     </Loggers>

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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf2f61e9/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
index 1dd8eb2..6d5df74 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -29,7 +29,6 @@ import org.apache.logging.log4j.core.Logger;
 import org.apache.logging.log4j.core.appender.*;
 import org.apache.logging.log4j.core.appender.routing.*;
 import org.apache.logging.log4j.core.config.*;
-import org.apache.logging.log4j.core.filter.*;
 import org.apache.logging.log4j.core.layout.*;
 import org.jetbrains.annotations.*;
 
@@ -275,18 +274,13 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware
{
 
             boolean consoleAppenderFound = false;
             Logger rootLogger = null;
-            ConsoleAppender errAppender = null;
 
             for (Logger log = impl; log != null; ) {
                 if (!consoleAppenderFound) {
                     for (Appender appender : log.getAppenders().values()) {
                         if (appender instanceof ConsoleAppender) {
-                            if ("CONSOLE_ERR".equals(appender.getName())) {
-                                // Treat CONSOLE_ERR appender as a system one and don't count
it.
-                                errAppender = (ConsoleAppender)appender;
-
+                            if ("CONSOLE_ERR".equals(appender.getName()))
                                 continue;
-                            }
 
                             consoleAppenderFound = true;
 
@@ -314,7 +308,7 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
 
                 // User launched ignite in verbose mode and did not add console appender
with INFO level
                 // to configuration and did not set IGNITE_CONSOLE_APPENDER to false.
-                consoleLog = createConsoleLogger(errAppender != null);
+                consoleLog = createConsoleLogger();
             }
 
             quiet0 = quiet;
@@ -327,7 +321,7 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
      *
      * @return Logger with auto configured console appender.
      */
-    public static Logger createConsoleLogger(boolean errConsoleAppenderWasFound) {
+    public static Logger createConsoleLogger() {
         LoggerContext ctx = (LoggerContext)LogManager.getContext(true);
 
         Configuration cfg = ctx.getConfiguration();
@@ -335,19 +329,14 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware
{
         PatternLayout layout = PatternLayout.createLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}]
%m%n", null, null,
             Charset.defaultCharset(), false, false, null, null);
 
-        ThresholdFilter filter = null;
-
-        if (errConsoleAppenderWasFound)
-            filter = ThresholdFilter.createFilter(Level.WARN, Filter.Result.DENY, Filter.Result.ACCEPT);
-
-        final Appender consoleApp = ConsoleAppender.createAppender(layout, filter, null,
CONSOLE_APPENDER, null, null);
+        final Appender consoleApp = ConsoleAppender.createAppender(layout, null, null, CONSOLE_APPENDER,
null, null);
         consoleApp.start();
 
         AppenderRef ref = AppenderRef.createAppenderRef(CONSOLE_APPENDER, Level.TRACE, null);
 
         AppenderRef[] refs = {ref};
 
-        LoggerConfig logCfg = LoggerConfig.createLogger("false", Level.ALL, LogManager.ROOT_LOGGER_NAME,
"",
+        LoggerConfig logCfg = LoggerConfig.createLogger("false", Level.INFO, LogManager.ROOT_LOGGER_NAME,
"",
             refs, null, null, null);
 
         logCfg.addAppender(consoleApp, null, null);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf2f61e9/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2SelfTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2SelfTest.java
b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2SelfTest.java
index 0342d8b..b97e3e8 100644
--- a/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2SelfTest.java
+++ b/modules/log4j2/src/test/java/org/apache/ignite/logger/log4j2/GridLog4j2SelfTest.java
@@ -148,16 +148,14 @@ public class GridLog4j2SelfTest extends TestCase {
                 assertTrue(consoleOut.contains(testMsg + Level.INFO));
                 assertTrue(consoleOut.contains(testMsg + Level.DEBUG));
                 assertTrue(consoleOut.contains(testMsg + Level.TRACE));
+                assertTrue(consoleOut.contains(testMsg + Level.ERROR));
+                assertTrue(consoleOut.contains(testMsg + Level.WARN));
 
                 assertTrue(consoleErr.contains(testMsg + Level.ERROR));
                 assertTrue(consoleErr.contains(testMsg + Level.WARN));
-
-                assertTrue(!consoleOut.contains(testMsg + Level.ERROR));
-                assertTrue(!consoleOut.contains(testMsg + Level.WARN));
-
                 assertTrue(!consoleErr.contains(testMsg + Level.INFO));
-                assertTrue(!consoleErr.contains(testMsg + Level.DEBUG));
-                assertTrue(!consoleErr.contains(testMsg + Level.TRACE));
+                assertTrue(consoleErr.contains(testMsg + Level.DEBUG));
+                assertTrue(consoleErr.contains(testMsg + Level.TRACE));
             }
         }
         finally {


Mime
View raw message