You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2008/08/20 13:17:34 UTC
DO NOT REPLY [Bug 45658] New: error when working with ConsoleAppender
https://issues.apache.org/bugzilla/show_bug.cgi?id=45658
Summary: error when working with ConsoleAppender
Product: Log4j
Version: 1.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: spamolovko@gmail.com
package ru.sanalis;
import org.apache.log4j.Logger;
public class LoggerTest {
static private Logger LOG = Logger.getLogger(LoggerTest.class);
static public void main(String[] args) {
LOG.debug("Debug > " + args);
LOG.fatal("Fatal > " + args);
}
}
Config:
# ***** Set root logger level to WARN and its two appenders to stdout and R.
log4j.rootLogger=debug, stdoutRoot
log4j.logger.ru=fatal, stdout
# ***** stdout is set to be a ConsoleAppender.
log4j.appender.stdoutRoot=org.apache.log4j.ConsoleAppender
# ***** stdout uses PatternLayout.
log4j.appender.stdoutRoot.layout=org.apache.log4j.PatternLayout
# ***** Pattern to output the caller's file name and line number.
log4j.appender.stdoutRoot.layout.ConversionPattern=%5p rootLog (%F:%L) - %m%n
# ***** stdout is set to be a ConsoleAppender.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
# ***** stdout uses PatternLayout.
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# ***** Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p normalLog (%F:%L) - %m%n
Should write:
DEBUG normalLog !!!
FATAL normalLog (LoggerTest.java:11) - Fatal > [Ljava.lang.String;@10b4199
FATAL rootLog (LoggerTest.java:11) - Fatal > [Ljava.lang.String;@10b4199
Console writes:
FATAL normalLog (LoggerTest.java:11) - Fatal > [Ljava.lang.String;@10b4199
FATAL rootLog (LoggerTest.java:11) - Fatal > [Ljava.lang.String;@10b4199
log4j.logger.ru=debug, stdout - loose to log LOG.debug("Debug > " + args);
With config:
# ***** Set root logger level to WARN and its two appenders to stdout and R.
log4j.rootLogger=fatal, stdoutRoot
log4j.logger.ru=debug, stdout
# ***** stdout is set to be a ConsoleAppender.
log4j.appender.stdoutRoot=org.apache.log4j.ConsoleAppender
# ***** stdout uses PatternLayout.
log4j.appender.stdoutRoot.layout=org.apache.log4j.PatternLayout
# ***** Pattern to output the caller's file name and line number.
log4j.appender.stdoutRoot.layout.ConversionPattern=%5p rootLog (%F:%L) - %m%n
# ***** stdout is set to be a ConsoleAppender.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
# ***** stdout uses PatternLayout.
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# ***** Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p normalLog (%F:%L) - %m%n
Output:
DEBUG normalLog (LoggerTest.java:10) - Debug > [Ljava.lang.String;@10b4199
DEBUG rootLog (LoggerTest.java:10) - Debug > [Ljava.lang.String;@10b4199
FATAL normalLog (LoggerTest.java:11) - Fatal > [Ljava.lang.String;@10b4199
FATAL rootLog (LoggerTest.java:11) - Fatal > [Ljava.lang.String;@10b4199
So rootLogger log DEBUG even with log4j.rootLogger=fatal, stdoutRoot
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 45658] error when working with ConsoleAppender
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45658
Jacob Kjome <ho...@visi.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Jacob Kjome <ho...@visi.com> 2008-08-20 07:32:11 PST ---
This is not a bug in Log4j. It is a simple matter of appender inheritance.
Appenders, inherited or otherwise, will append at the effective logging level
of the logger in question, not the level of the logger the appender was
inherited from... unless, of course, the logging level is inherited, which is
not the case here anyway. Marking invalid.
Jake
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org