You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Nicolas Marchildon <ni...@marchildon.net> on 2001/07/17 00:52:47 UTC

SMTPAppender not sending context

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

ice.com
1085 St.Alexander St.
Suite 102
Montreal, Quebec
Canada, H2Z 1P4

http://www.ice.com
Email: nicolas@ice.com
P +1.514.393-9788
F +1.514.293-1295


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


Re: SMTPAppender not sending context

Posted by Ceki Gülcü <cg...@qos.ch>.
Nicolas,

This should go to the users list. Ceki 

At 18:52 16.07.2001 -0400, Nicolas Marchildon wrote:
>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
>
>ice.com
>1085 St.Alexander St.
>Suite 102
>Montreal, Quebec
>Canada, H2Z 1P4
>
>http://www.ice.com
>Email: nicolas@ice.com
>P +1.514.393-9788
>F +1.514.293-1295
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

--
Ceki Gülcü - http://qos.ch


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


Re: SMTPAppender not sending context

Posted by Nicolas Marchildon <ni...@marchildon.net>.
In fact, SMTPAppender does exactly what I want. It did not work only because 
I did the mistake of setting its threshold parameter to ERROR instead of 
DEBUG.

Thanks anyway,

Nicolas

On Monday 16 July 2001 20:44, you wrote:
> At 18:52 16.07.2001 -0400, Nicolas Marchildon wrote:
> >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?
>
> I am afraid it does not make sense. In particular because the threshold
> parameter and the triggering threshold are separate independent variables.
> Regards, Ceki
>
>
> --
> Ceki Gülcü - http://qos.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

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


Re: SMTPAppender not sending context

Posted by Ceki Gülcü <cg...@qos.ch>.
At 18:52 16.07.2001 -0400, Nicolas Marchildon wrote:
>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?

I am afraid it does not make sense. In particular because the threshold parameter and the triggering threshold are separate independent variables. Regards, Ceki


--
Ceki Gülcü - http://qos.ch


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