You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Wes Rood <wr...@bnyclearing.com> on 2001/02/23 18:52:55 UTC

SmtpAppender for ERROR conditions

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
log4j.category.com=DEBUG, STD_OUT, ROOT_FILE

(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







The information in this e-mail, and any attachment therein,
is confidential and for use by the addressee only.
If you are not the intended recipient, please return the 
e-mail to the sender and delete it from your computer. 
Although BNY Clearing Services LLC attempts to 
sweep e-mail and attachments for viruses, it does not
guarantee that either are virus-free and accepts 
no liability for any damage sustained as a result of viruses. 

RE: SmtpAppender for ERROR conditions

Posted by Rex Madden <re...@microcreditcard.com>.
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-----
From: Wes Rood [mailto:wrood@bnyclearing.com]
Sent: Friday, February 23, 2001 12:53 PM
To: log4j-user@jakarta.apache.org
Subject: SmtpAppender for ERROR conditions

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
log4j.category.com=DEBUG, STD_OUT, ROOT_FILE
(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







The information in this e-mail, and any attachment therein,
is confidential and for use by the addressee only.
If you are not the intended recipient, please return the
e-mail to the sender and delete it from your computer.
Although BNY Clearing Services LLC attempts to
sweep e-mail and attachments for viruses, it does not
guarantee that either are virus-free and accepts
no liability for any damage sustained as a result of viruses.