declare a separate logger with your SPECIAL_APPENDER attached and additivity 
flag false. You are not forced to use the classname as logger name. You can 
choose any string (i.e. "SPECIAL_LOGGER"). 
Heri

> -----Original Message-----
> From: Bryce Nesbitt [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 14, 2006 7:02 AM
> To: log4j-user@logging.apache.org
> Subject: [SPAM (Bayesain Analysis)] - Sending "special" messages to a
> different appender - Bayesian Filter detected spam
> 
> 
> I wish to write a separate log of certain special and important
> messages.  In perl, this might go:
> 
>     print NORMALLOG "foo";
>     print NORMALLOG "fum"
>     print SPECIALLOG "special message";
> 
> Can this be done with log4j?  This would be something looking 
> roughly like:
> 
>     logger.info("fum");
>     logger.debug("foo");
>     logger.debug("loo");
>     logger.info(SPECIAL_APPENDER,"foo");
> 
> I can't divide these messages based on the class that's 
> printing them. 
> I somehow need to create a new and totally separate log file.  Is this
> possible?
> 
>           -Bryce
> 
> 
> PS1:  Why?  This is a poorman's mirroring system.  The idea 
> is to dump a
> certain special checkpoint messages to a remote syslog server 
> for archiving.
> 
> PS1: the log4j.properties file is:
> 
> log4j.appender.A1 = org.apache.log4j.RollingFileAppender
> log4j.appender.A1.file = /tmp/fooble.log
> log4j.appender.A1.layout = org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.conversionPattern = %d %-5p %m - %c{2}%n
> log4j.appender.A1.append = false
> 
> log4j.appender.SPECIAL_APPENDER=org.apache.log4j.net.SyslogAppender
> log4j.appender.SPECIAL_APPENDER.SPECIAL_APPENDERHost=209.99.99.31
> log4j.appender.SPECIAL_APPENDER.layout=org.apache.log4j.PatternLayout
> log4j.appender.SPECIAL_APPENDER.layout.ConversionPattern=%p: %c - %m
> log4j.appender.SPECIAL_APPENDER.Facility=SPECIAL_APPENDER
> 
> log4j.rootLogger=ERROR, A1
> log4j.category.org.foo.fum = SPECIAL_APPENDER
> 
> This works fine, except org.foo.fum needs to continue to send regular
> output to A1, without cluttering SPECIAL_APPENDER.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to