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 Vladyslav Kosulin <ko...@yahoo.com> on 2004/01/27 15:28:12 UTC

ASYNC + SMTP appender with JBoss configuration

Hi all,
I use JBoss 3.2.3 with log4j
I activated SMTP appender to send errors by e-mail, but can't properly configure 
it. Every time an Exception happens, I receive a lot of e-mails with every 
e-mail body containing only 1 line of the Exception trace log, like:


[16:49:04,315,STDERR]     at 
com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1596)



Here is log4j config:

    <appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="Threshold" value="ERROR"/>
      <param name="To" value="..."/>
      <param name="From" value="..."/>
      <param name="Subject" value="${jboss.server.name} JBoss Error"/>
      <param name="SMTPHost" value="..."/>
      <param name="BufferSize" value="100"/>
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="[%d{ABSOLUTE},%c{1}] %m\r\n"/>
      </layout>
    </appender>

    <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <appender-ref ref="SMTP"/>
    </appender>

What's wrong?
How to configure it to e-mail the whole trace at once?

Thanks,
Vlad


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


Re: ASYNC + SMTP appender with JBoss configuration

Posted by Vladyslav Kosulin <ko...@yahoo.com>.
Ionel GARDAIS wrote:

> Hi Vladyslav,
> 
> The line <param name="BufferSize" value="100"/>
> declares a buffer of 100 events to send with the
> message each time an error occurs.
> 
> To reduce the amount of message received in the body
> of your mail, just decrease the buffersize value.

According to JavaDoc, BufferSize does not intersect with a message body contents:
"The BufferSize option takes a positive integer representing the maximum number 
of logging events to collect in a cyclic buffer. When the BufferSize is reached, 
oldest events are deleted as new events are added to the buffer. By default the 
size of the cyclic buffer is 512 events."

As I understand, the problem is that every line from the exception trace is a 
separate logging event. How to change this?


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


Re: ASYNC + SMTP appender with JBoss configuration

Posted by Ionel GARDAIS <ig...@yahoo.fr>.
Hi Vladyslav,

The line <param name="BufferSize" value="100"/>
declares a buffer of 100 events to send with the
message each time an error occurs.

To reduce the amount of message received in the body
of your mail, just decrease the buffersize value.

hope this could help,
ionel

_________________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

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