logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-219) Named logger without root logger ends up with empty Appenders map - does not log anything
Date Wed, 01 May 2013 13:42:16 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13646579#comment-13646579
] 

Remko Popma commented on LOG4J2-219:
------------------------------------

>From the dev mailing list:
..., then to summarize my understanding for LOG4J2-219 the solution would be to:
* internally create a root logger if one isn't explicitly configured (like in beta5)
* this default root logger would have level ERROR  (like in beta5)
* this default root logger would not have any appenders configured  (different from beta5)
* named loggers in the config are picked up correctly and not ignored  (different from beta5)

                
> Named logger without root logger ends up with empty Appenders map - does not log anything
> -----------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-219
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-219
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-beta5
>            Reporter: Remko Popma
>
> On the log4j-user mailing list, Peter DePasquale gave this test case that demonstrates
the problem:
> Note that the configuration has no root logger, but only contains a named logger.
> In a debugger I found that the LoggerConfig for "logtest.LogTest" ended up with an empty
"appenders" Map<String, AppenderControl<?>>. The appenderRefs list did contain
an AppenderRef object but in #callAppenders there are no AppenderControl objects to call...
 
> (Sorry, I have been unable to find out the underlying cause yet.)
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration status="warn">
> 	<appenders>
> 		<File name="tracelog" fileName="trace-log.txt" 
> 				immediateFlush="true" append="false">
> 			<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
> 		</File>
> 	</appenders>
> 	
> 	<loggers>
> 		<logger name="logtest.LogTest" level="trace">
> 			<appender-ref ref="tracelog"/>
> 		</logger>
> 	</loggers>
> </configuration>
> package logtest;
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger;
> import org.apache.logging.log4j.core.config.XMLConfigurationFactory;
> public class LogTest {
> 	public static void main(String[] args) {
> 		System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
> 				"log4j2-roottest.xml");
> 		Logger logger = LogManager.getLogger(LogTest.class);
> 		logger.trace("This is a trace message");
> 		logger.info("This is an info message");
> 		logger.warn("This is a warning message");
> 	}
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message