logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1502746 - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/test/java/org/apache/logging/log4j/ log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/ src/changes/
Date Sat, 13 Jul 2013 05:16:15 GMT
Author: ggregory
Date: Sat Jul 13 05:16:14 2013
New Revision: 1502746

URL: http://svn.apache.org/r1502746
Log:
[LOG4J2-305] Ease porting from 1.x Logger.getRootLogger(): add LogManager.getRootLogger().

Modified:
    logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
    logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/LoggerTest.java
    logging/log4j/log4j2/trunk/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java?rev=1502746&r1=1502745&r2=1502746&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
(original)
+++ logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/LogManager.java
Sat Jul 13 05:16:14 2013
@@ -412,6 +412,15 @@ public class LogManager {
     }
 
     /**
+     * Returns the root logger.
+     * 
+     * @return the root logger, named {@link #ROOT_LOGGER_NAME}.
+     */
+	public static Logger getRootLogger() {
+		return getLogger(ROOT_LOGGER_NAME);
+	}
+
+    /**
      * Prevents instantiation
      */
     protected LogManager() {

Modified: logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/LoggerTest.java?rev=1502746&r1=1502745&r2=1502746&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/LoggerTest.java
(original)
+++ logging/log4j/log4j2/trunk/api/src/test/java/org/apache/logging/log4j/LoggerTest.java
Sat Jul 13 05:16:14 2013
@@ -271,6 +271,15 @@ public class LoggerTest {
     }
 
     @Test
+    public void getRootLogger() {
+        assertNotNull(LogManager.getRootLogger());
+        assertNotNull(LogManager.getLogger(""));
+        assertNotNull(LogManager.getLogger(LogManager.ROOT_LOGGER_NAME));
+        assertEquals(LogManager.getRootLogger(), LogManager.getLogger(""));
+        assertEquals(LogManager.getRootLogger(), LogManager.getLogger(LogManager.ROOT_LOGGER_NAME));
+    }
+
+    @Test
     public void isAllEnabled() {
         assertTrue("Incorrect level", logger.isEnabled(Level.ALL));
     }

Modified: logging/log4j/log4j2/trunk/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java?rev=1502746&r1=1502745&r2=1502746&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LoggerTest.java
Sat Jul 13 05:16:14 2013
@@ -60,7 +60,7 @@ public class LoggerTest {
         configure(CONFIG);
         logger = LogManager.getLogger(LoggerTest.class);
         assertTrue("Incorrect SLF4J Logger", ((SLF4JLogger) logger).getLogger() == slf4jLogger);
-        root = LogManager.getLogger("");
+        root = LogManager.getRootLogger();
         rootLogger = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
         list = (StringListAppender<ILoggingEvent>) rootLogger.getAppender("LIST");
         rootLogger.detachAppender("console");

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1502746&r1=1502745&r2=1502746&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Sat Jul 13 05:16:14 2013
@@ -21,6 +21,9 @@
   </properties>
   <body>
     <release version="2.0-beta9" date="soon, very soon" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-305" dev="ggregory" type="add">
+        Ease porting from 1.x Logger.getRootLogger(): add LogManager.getRootLogger().
+      </action>
       <action issue="LOG4J2-304" dev="rpopma" type="fix">
         Fixed Async Loggers memory leak.
       </action>



Mime
View raw message