logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dhruva B. Reddy" <sledgehammer2...@yahoo.com>
Subject Messages Going to Multiple Loggers
Date Fri, 19 Sep 2003 16:56:46 GMT
I am using Log4J 1.2.8 for a standalone application running on Linux. 
I have two loggers defined--one for general use that goes to syslog and
another for sending e-mails when the application starts and finishes.

I use the following configuration:

# General logging properties...
log4j.rootLogger=debug,general

# Log to syslog...
log4j.appender.general=org.apache.log4j.net.SyslogAppender
log4j.appender.general.SyslogHost=localhost
log4j.appender.general.layout=org.apache.log4j.PatternLayout
log4j.appender.general.layout.ConversionPattern=%p: %m
log4j.appender.general.Facility=local7

# For sending e-mails...
log4j.logger.notify=debug,email

log4j.appender.email=org.apache.log4j.net.SMTPAppender
log4j.appender.email.to=moi@localhost
log4j.appender.email.from=moi@localhost
log4j.appender.email.SMTPHost=localhost
log4j.appender.email.subject=Something Happened
log4j.appender.email.layout=org.apache.log4j.PatternLayout
log4j.appender.email.layout.ConversionPattern=%m

In the code in which I wish to send an e-mail, I do this:

    // Need this for general logging...
    Logger log = Logger.getLogger(SomeClass.class);

    // Need this notification of specific events...
    Logger email = Logger.getLogger("notify");

The problem is that when I use "email", the message is not only
e-mailed, but it also goes to syslog (which I don't want).  Is there a
way to make these log messages appear only in e-mail messages?

Thanks,
Dhruva



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message