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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to