Hi,
I have a critical process that I want to monitor. Whenever there is an error, I
want to be emailed all the debugging information, consisting of the DEBUG
statements starting from the beginning of the process.
At the beggining of the critical process, I set up a SMTPAppender, and add it
to the root category. When I'm done, I remove the appender. I set up the
SMTPAppender to send its buffer on ERRORs.
I realized I was e-mailed only with the ERROR log statement, without the DEBUG
ones, and I looked at the log4j source code to figure out why. The SMTPAppender
does not seem to use its buffer really much, because it does not get all the
events it should.
In org.apache.log4j.AppenderSkeleton.doAppend(LoggingEvent), I saw the
following:
if(!isAsSevereAsThreshold(event.priority)) {
return;
}
When I comment this out, the SMTPAppender gets the logging statements and adds
them to its buffer.
But I think it also means all appenders will get the log statements even if
they were set up to receive them beginning at a specified threshold. Therefore,
commenting out this "isAsSevereAsThreshold" check is not a solution.
My advice is that there should be two thresholds for the SMTPAppender. The
first is the current standard threshold. The SMTPAppender would not get events
with lesser importance than this threshold.
The other threshold would be the one that would actually trigger the e-mail to
be sent, and would be specific to the SMTPAppender. By default, it could be set
to be the same as the standard threshold, so the class behaves as it does right
now.
Does that makes sense?
--
Nicolas Marchildon
Software Developper
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]