You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Sudarshan Krishnaprasad <sk...@cait.org> on 2003/10/13 21:26:54 UTC
Problem with multiple appenders.
Hi,
The log4j.properties file is as shown below. I have 2 appenders set and
wish to log the different levels to different places.
log4j.properties
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
log4j.appender.R=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.R.URL=jdbc:mysql://localhost/test
log4j.appender.R.user=test
log4j.appender.R.password=test
log4j.appender.R.sql=INSERT INTO logTable
(timestamp,priority,filename,msg) VALUES ('%d', '%p', '%c', '%m')
log4j.rootLogger=ALL, stdout
log4j.logger.database=ERROR, R
The problem I am having is that all the messages are getting logged at
the console but none of them are getting logged to the database.
If I change the file a little bit and set the root logger to log at
both the places like:
log4j.rootLogger=ALL, stdout, R
Now all the messages are logged in both the places. Could anyone please
tell me if the above methods for having multiple loggers is correct.
Regards,
Sudarshan.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org