difficulty with log4j syntax - splitting off some output to a different appender
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bryce_Nesbitt
Posted On:   Monday, September 18, 2006 01:30 AM

I'd like to send most of my logs to a file appender, but some special logs to a SYSLOG appender. Here's what I have: log4j.appender.A1 = org.apache.log4j.RollingFileAppender log4j.appender.A1.file = /tmp/v2.log log4j.appender.A1.MaxFileSize = 10MB log4j.appender.A1.MaxBackupIndex = 5 log4j.appender.A1.layout = org.apache.log4j.PatternLayout log4j.appender.A1.layout.conversionPattern = %d %-5p %m - %c{2}%n log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender log4j.appender.SYSLOG.Facility=SYSLOG log4j.appender.SYSLOG.syslogHost=localhost log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout log4j.appender.SYSLOG.layout.ConversionPattern=%p: %c -   More>>

I'd like to send most of my logs to a file appender, but some special logs to a SYSLOG appender. Here's what I have:

			
log4j.appender.A1 = org.apache.log4j.RollingFileAppender
log4j.appender.A1.file = /tmp/v2.log
log4j.appender.A1.MaxFileSize = 10MB
log4j.appender.A1.MaxBackupIndex = 5
log4j.appender.A1.layout = org.apache.log4j.PatternLayout
log4j.appender.A1.layout.conversionPattern = %d %-5p %m - %c{2}%n

log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.Facility=SYSLOG
log4j.appender.SYSLOG.syslogHost=localhost
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%p: %c - %m

log4j.rootLogger=ERROR, A1
log4j.category.com.foo = DEBUG
log4j.catetory.com.foo.business.sql.SQLReservationManager= ERROR, SYSLOG, A1


What I want is for the "ERROR" messages from class SQLReservationManager to go to SYSLOG. But as I play with the syntax, either I get all the messages or none of them. What am I missing?    <<Less
About | Sitemap | Contact