I believe
by default, the SMTPappender only logs errors and fatals, so you should just be
able to add it to your original root category (or you can keep using your .com
category, it doesn’t matter). Each
appender also has a threshold option, whereby you can set it to only log errors
and higher. For example, we only
log info and higher to our std_out, since we don’t want to see all debug
statements on our console. Then
our file appender logs everything, and our email appender does just errors and
higher. Sounds like pretty much
like what you want as well. See the
AppenderSkeleton in the javadoc for the threshold option, and the SMTPAppender
for the email explanation. Sorry for
giving you more than what you asked for.
Hope I didn’t confuse you more. Rex -----Original
Message----- We're
currently logging DEBUG priority statements to std out and a log file, now we'd
like to send email for serious problems in the code. our
original config file was: log4j.rootCategory=DEBUG,
STD_OUT, ROOT_FILE And we
changed it to: log4j.rootCategory=ERROR,
EMAIL (I'll
omit the configuration of each appender...) All of
our categories are named after the full package name of the class they're in,
so "log4j.category.com" effectively covers all our categories. Is this
the best way to do it?.. it just seems strange that rootCategory is the email
appender, while log4j.category.com (which is also a "root" category)
is set to what rootCategory used to be. Am I missing some concepts? One
other way would be to define a new category called "mail", and then
our code would have to instantiate another category for emailing, in addition
to the normal category named after the individual class. Any
ideas? Thanks, Wes
|
- SmtpAppender for ERROR conditions Wes
- Re: SmtpAppender for ERROR conditions Ceki Gülcü
- Fw: SmtpAppender for ERROR conditions Wes
- Re: Fw: SmtpAppender for ERROR conditions Ceki Gülcü
- SmtpAppender for ERROR conditions Wes Rood
- Rex Madden