Log4J (and most other logging packages) will log a
message if its level = the defined level. So
log4j.rootLogger=DEBUG, stdout, rolling
will log FATAL, ERROR, INFO, DEBUG into rolling.
--- Pingili, Madhupal [EMAIL PROTECTED] wrote:
Hi All,
Can I use two loggers in one Action?
I have set the Commons logging to use log4j.
I need to log error messages in one file and all
other messages in another
file.
In log4j.properties, I have following lines:
# log4j properties file
log4j.rootLogger=DEBUG, stdout, rolling
log4j.logger.pilotErrors=WARN, A2
# Configure the rolling and A2 appenders to be
FileAppender
log4j.appender.rolling=org.apache.log4j.FileAppender
log4j.appender.A2=org.apache.log4j.FileAppender
...
In my Action,
// The Log instance for application's debug
messages.
Log log = LogFactory.getLog(this.getClass());
//supposed to use rootLogger
// The Log instance for application's error
messages.
Log logError = LogFactory.getLog(pilotErrors);
//supposed to use
pilotErrors logger
log.debug(User[ + userName + ]: + User has
+
invoked initialization action in session
+ session.getId() );
logError.error(User[' + userName + ']: + User
has +
invoked initialization action in
session +
session.getId() );
Both debug and error messages are written in file
specified with rolling
FileAppender. Why?
What am I missing??
Thanks for any ideas,
Reddy
-
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
__
Do You Yahoo!?
Send free SMS from your PC!
http://sg.sms.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]