logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1405663 - in /logging/log4j/log4j2/trunk: core/src/main/java/org/apache/logging/log4j/core/config/ core/src/test/java/org/apache/logging/log4j/core/config/ core/src/test/resources/bad/ log4j12-api/src/test/java/org/apache/log4j/
Date Sun, 04 Nov 2012 23:12:29 GMT
Author: rgoers
Date: Sun Nov  4 23:12:28 2012
New Revision: 1405663

URL: http://svn.apache.org/viewvc?rev=1405663&view=rev
Log:
Add unit tests for bad configurations

Added:
    logging/log4j/log4j2/trunk/core/src/test/resources/bad/
    logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilename.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilterparam.xml
      - copied, changed from r1405503, logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badlayout.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-loggers.xml
      - copied, changed from r1405503, logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-nofilter.xml
    logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-status.xml
      - copied, changed from r1405503, logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml
Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java?rev=1405663&r1=1405662&r2=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
Sun Nov  4 23:12:28 2012
@@ -16,10 +16,13 @@
  */
 package org.apache.logging.log4j.core.config;
 
+import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.config.plugins.PluginAttr;
 import org.apache.logging.log4j.core.config.plugins.PluginConfiguration;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
@@ -30,6 +33,7 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginValue;
 import org.apache.logging.log4j.core.filter.AbstractFilterable;
 import org.apache.logging.log4j.core.helpers.NameUtil;
+import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.lookup.Interpolator;
 import org.apache.logging.log4j.core.lookup.StrLookup;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
@@ -182,9 +186,13 @@ public class BaseConfiguration extends A
         }
 
         if (!setLoggers) {
-            LOGGER.warn("No Loggers were configured, using default");
+            LOGGER.warn("No Loggers were configured, using default. Is the Loggers element
missing?");
+            setToDefault();
+            return;
         } else if (!setRoot) {
             LOGGER.warn("No Root logger was configured, using default");
+            setToDefault();
+            return;
         }
 
         for (Map.Entry<String, LoggerConfig> entry : loggers.entrySet()) {
@@ -203,6 +211,21 @@ public class BaseConfiguration extends A
         setParents();
     }
 
+    private void setToDefault() {
+        setName(DefaultConfiguration.DEFAULT_NAME);
+        Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}
- %msg%n",
+            null, null, null);
+        Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console",
"true");
+        appender.start();
+        addAppender(appender);
+        LoggerConfig root = getRootLogger();
+        root.addAppender(appender, null, null);
+
+        String levelName = System.getProperty(DefaultConfiguration.DEFAULT_LEVEL);
+        Level level = levelName != null && Level.valueOf(levelName) != null ? Level.valueOf(levelName)
: Level.ERROR;
+        root.setLevel(level);
+    }
+
     protected PluginManager getPluginManager() {
         return pluginManager;
     }
@@ -586,7 +609,9 @@ public class BaseConfiguration extends A
                                 first = false;
                                 Object obj = child.getObject();
                                 if (obj == null) {
-                                    System.out.println("Null object returned for " + child.getName());
+                                    LOGGER.error("Null object returned for " + child.getName()
+ " in " +
+                                        node.getName());
+                                    continue;
                                 }
                                 if (obj.getClass().isArray()) {
                                     printArray(sb, (Object[]) obj);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java?rev=1405663&r1=1405662&r2=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
Sun Nov  4 23:12:28 2012
@@ -56,4 +56,8 @@ public class DefaultConfiguration extend
         Level level = levelName != null && Level.valueOf(levelName) != null ? Level.valueOf(levelName)
: Level.ERROR;
         root.setLevel(level);
     }
+
+    @Override
+    protected void doConfigure() {
+    }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java?rev=1405663&r1=1405662&r2=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java
Sun Nov  4 23:12:28 2012
@@ -103,6 +103,9 @@ public class Node {
 
     @Override
     public String toString() {
+        if (object == null) {
+            return "null";
+        }
         return type.isObjectPrintable() ? object.toString() :
             type.getPluginClass().getName() + " with name " + name;
     }

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1405663&r1=1405662&r2=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
Sun Nov  4 23:12:28 2012
@@ -16,18 +16,25 @@
  */
 package org.apache.logging.log4j.core.config;
 
+import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.filter.CompositeFilter;
+
 import org.junit.Test;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.util.Map;
 
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 /**
  *
@@ -36,6 +43,8 @@ public class TestConfigurator {
 
     private static final String CONFIG_NAME = "ConfigTest";
 
+    private static final String FILESEP = System.getProperty("file.separator");
+
 
     @Test
     public void testFromFile() throws Exception {
@@ -154,4 +163,75 @@ public class TestConfigurator {
         assertTrue("Incorrect Configuration. Expected " + DefaultConfiguration.DEFAULT_NAME
+ " but found " +
             config.getName(), DefaultConfiguration.DEFAULT_NAME.equals(config.getName()));
     }
+
+    @Test
+    public void testNoLoggers() throws Exception {
+        LoggerContext ctx = Configurator.initialize("Test1", null, "bad/log4j-loggers.xml");
+        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
+        Configuration config = ctx.getConfiguration();
+        assertNotNull("No configuration", config);
+        assertTrue("Unexpected configuration", DefaultConfiguration.DEFAULT_NAME.equals(config.getName()));
+    }
+
+    @Test
+    public void testBadStatus() throws Exception {
+        LoggerContext ctx = Configurator.initialize("Test1", null, "bad/log4j-status.xml");
+        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
+        Configuration config = ctx.getConfiguration();
+        assertNotNull("No configuration", config);
+        assertTrue("Unexpected configuration", "XMLConfigTest".equals(config.getName()));
+        LoggerConfig root = config.getLoggerConfig("");
+        assertNotNull("No Root Logger", root);
+        assertTrue("Expected error level, was " + root.getLevel(), Level.ERROR == root.getLevel());
+    }
+
+    @Test
+    public void testBadFilterParam() throws Exception {
+        LoggerContext ctx = Configurator.initialize("Test1", null, "bad/log4j-badfilterparam.xml");
+        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
+        Configuration config = ctx.getConfiguration();
+        assertNotNull("No configuration", config);
+        assertTrue("Unexpected configuration", "XMLConfigTest".equals(config.getName()));
+        LoggerConfig lcfg = config.getLoggerConfig("org.apache.logging.log4j.test1");
+        assertNotNull("No Logger", lcfg);
+        Filter filter = lcfg.getFilter();
+        assertNull("Unexpected Filter", filter);
+    }
+
+    @Test
+    public void testNoFilters() throws Exception {
+        LoggerContext ctx = Configurator.initialize("Test1", null, "bad/log4j-nofilter.xml");
+        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
+        Configuration config = ctx.getConfiguration();
+        assertNotNull("No configuration", config);
+        assertTrue("Unexpected configuration", "XMLConfigTest".equals(config.getName()));
+        LoggerConfig lcfg = config.getLoggerConfig("org.apache.logging.log4j.test1");
+        assertNotNull("No Logger", lcfg);
+        Filter filter = lcfg.getFilter();
+        assertNotNull("No Filter", filter);
+        assertTrue("Incorrect filter", filter instanceof CompositeFilter);
+        assertFalse("Unexpected filters", ((CompositeFilter) filter).hasFilters());
+    }
+
+    @Test
+    public void testBadLayout() throws Exception {
+        LoggerContext ctx = Configurator.initialize("Test1", null, "bad/log4j-badlayout.xml");
+        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
+        Configuration config = ctx.getConfiguration();
+        assertNotNull("No configuration", config);
+        assertTrue("Unexpected configuration", "XMLConfigTest".equals(config.getName()));
+    }
+
+    @Test
+    public void testBadFileName() throws Exception {
+        String value = FILESEP.equals("/") ? "/rootdir/test.log" : "1:/target/bad:file.log";
+        System.setProperty("testfile", value);
+        LoggerContext ctx = Configurator.initialize("Test1", null, "bad/log4j-badfilename.xml");
+        Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
+        Configuration config = ctx.getConfiguration();
+        assertNotNull("No configuration", config);
+        assertTrue("Unexpected configuration", "XMLConfigTest".equals(config.getName()));
+        assertTrue("Create bad appender", config.getAppenders().size() == 2);
+    }
+
 }

Added: logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilename.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilename.xml?rev=1405663&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilename.xml (added)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilename.xml Sun Nov 
4 23:12:28 2012
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<configuration status="warn" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+
+
+  <appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <File name="File" fileName="${sys:testfile}" bufferedIO="false">
+      <PatternLayout>
+        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
+      </PatternLayout>
+    </File>
+    <List name="List">
+      <filters>
+        <ThresholdFilter level="error"/>
+      </filters>
+    </List>
+  </appenders>
+
+  <loggers>
+    <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+        <ThreadContextMapFilter>
+          <KeyValuePair key="test" value="123"/>
+        </ThreadContextMapFilter>
+      <appender-ref ref="STDOUT"/>
+    </logger>>
+
+    <logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
+      <appender-ref ref="File"/>
+    </logger>>
+
+    <root level="error">
+      <appender-ref ref="STDOUT"/>
+    </root>
+  </loggers>
+
+</configuration>
\ No newline at end of file

Copied: logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilterparam.xml (from
r1405503, logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilterparam.xml?p2=logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilterparam.xml&p1=logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml&r1=1405503&r2=1405663&rev=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml (original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badfilterparam.xml Sun Nov
 4 23:12:28 2012
@@ -41,7 +41,7 @@
   <loggers>
     <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
         <ThreadContextMapFilter>
-          <KeyValuePair key="test" value="123"/>
+          <KeyValuePair key1="test" value="123"/>
         </ThreadContextMapFilter>
       <appender-ref ref="STDOUT"/>
     </logger>>

Added: logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badlayout.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badlayout.xml?rev=1405663&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badlayout.xml (added)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-badlayout.xml Sun Nov  4
23:12:28 2012
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<configuration status="warn" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+  <properties>
+    <property name="filename">target/test.log</property>
+  </properties>
+  <ThresholdFilter level="debug"/>
+
+  <appenders>
+    <Console name="STDOUT">
+      <TypoLayout pattern="%m%n"/>
+    </Console>
+    <File name="File" fileName="${filename}" bufferedIO="false">
+      <PatternLayout>
+        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
+      </PatternLayout>
+    </File>
+    <List name="List">
+      <filters>
+        <ThresholdFilter level="error"/>
+      </filters>
+    </List>
+  </appenders>
+
+  <loggers>
+    <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+      <appender-ref ref="STDOUT"/>
+    </logger>>
+
+    <logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
+      <appender-ref ref="File"/>
+    </logger>>
+
+    <root level="error">
+      <appender-ref ref="STDOUT"/>
+    </root>
+  </loggers>
+
+</configuration>
\ No newline at end of file

Copied: logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-loggers.xml (from r1405503,
logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-loggers.xml?p2=logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-loggers.xml&p1=logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml&r1=1405503&r2=1405663&rev=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml (original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-loggers.xml Sun Nov  4 23:12:28
2012
@@ -38,7 +38,6 @@
     </List>
   </appenders>
 
-  <loggers>
     <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
         <ThreadContextMapFilter>
           <KeyValuePair key="test" value="123"/>
@@ -53,6 +52,5 @@
     <root level="error">
       <appender-ref ref="STDOUT"/>
     </root>
-  </loggers>
 
 </configuration>
\ No newline at end of file

Added: logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-nofilter.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-nofilter.xml?rev=1405663&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-nofilter.xml (added)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-nofilter.xml Sun Nov  4 23:12:28
2012
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<configuration status="warn" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+  <properties>
+    <property name="filename">target/test.log</property>
+  </properties>
+  <ThresholdFilter level="debug"/>
+
+  <appenders>
+    <Console name="STDOUT">
+      <PatternLayout pattern="%m%n"/>
+    </Console>
+    <File name="File" fileName="${filename}" bufferedIO="false">
+      <PatternLayout>
+        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
+      </PatternLayout>
+    </File>
+    <List name="List">
+      <filters>
+        <ThresholdFilter level="error"/>
+      </filters>
+    </List>
+  </appenders>
+
+  <loggers>
+    <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
+        <filters>
+          <!-- This isn't really an error -->
+        </filters>
+      <appender-ref ref="STDOUT"/>
+    </logger>>
+
+    <logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
+      <appender-ref ref="File"/>
+    </logger>>
+
+    <root level="error">
+      <appender-ref ref="STDOUT"/>
+    </root>
+  </loggers>
+
+</configuration>
\ No newline at end of file

Copied: logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-status.xml (from r1405503,
logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-status.xml?p2=logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-status.xml&p1=logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml&r1=1405503&r2=1405663&rev=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/resources/log4j-test1.xml (original)
+++ logging/log4j/log4j2/trunk/core/src/test/resources/bad/log4j-status.xml Sun Nov  4 23:12:28
2012
@@ -16,7 +16,7 @@
  limitations under the License.
 
 -->
-<configuration status="warn" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+<configuration status="warning" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
   <properties>
     <property name="filename">target/test.log</property>
   </properties>

Modified: logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java?rev=1405663&r1=1405662&r2=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
(original)
+++ logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/BasicConfigurationFactory.java
Sun Nov  4 23:12:28 2012
@@ -49,9 +49,14 @@ public class BasicConfigurationFactory e
 
         public BasicConfiguration() {
             LoggerConfig root = getRootLogger();
+            setName("BasicConfiguration");
             String levelName = System.getProperty(DEFAULT_LEVEL);
             Level level = (levelName != null && Level.valueOf(levelName) != null)
? Level.valueOf(levelName) : Level.DEBUG;
             root.setLevel(level);
         }
+
+        @Override
+        protected void doConfigure() {
+        }
     }
 }

Modified: logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java?rev=1405663&r1=1405662&r2=1405663&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java
Sun Nov  4 23:12:28 2012
@@ -130,15 +130,15 @@ public class LoggerTest {
         ca.start();
         a.getLogger().addAppender(ca);
 
-        assertEquals(ca.counter, 0);
+        assertEquals(0, ca.counter);
         ab.debug(MSG);
-        assertEquals(ca.counter, 1);
+        assertEquals(1, ca.counter);
         ab.info(MSG);
-        assertEquals(ca.counter, 2);
+        assertEquals(2, ca.counter);
         ab.warn(MSG);
-        assertEquals(ca.counter, 3);
+        assertEquals(3, ca.counter);
         ab.error(MSG);
-        assertEquals(ca.counter, 4);
+        assertEquals(4, ca.counter);
         ca.stop();
         a.getLogger().removeAppender(ca);
     }



Mime
View raw message