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 "Sebastian Frömel (JIRA)" <ji...@apache.org> on 2017/02/14 11:02:41 UTC

[jira] [Commented] (LOG4J2-1071) Allow for bufferSize=0 in SMTP appender

    [ https://issues.apache.org/jira/browse/LOG4J2-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865586#comment-15865586 ] 

Sebastian Frömel commented on LOG4J2-1071:
------------------------------------------

Yes I was surprised too, since we update to Log4j2. 
We use the SMTP-sender for error emails with:

			<Filters>
				<ThresholdFilter level="ERROR" onMatch="ACCEPT" />
			</Filters>

But with Buffer 1 we get sometimes Log-Messages (INFO/WARN)  up to 30 Minutes before the error. - Not related at all. 
And if you not look closely enough you think you found a strange error, which is just a warn before the error.

Our e-mail-filter also have a hard time, since they sometimes match text in the message before the error and sort them into the incorrect folder on our system.

Overall not as nice as it could be :(

> Allow for bufferSize=0 in SMTP appender
> ---------------------------------------
>
>                 Key: LOG4J2-1071
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1071
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 2.3
>            Reporter: Benjamin Jaton
>            Priority: Minor
>
> From the doc:
> "The number of logging events delivered in this e-mail depend on the value of BufferSize option. The SMTPAppender keeps only the last BufferSize logging events in its cyclic buffer. This keeps memory requirements at a reasonable level while still delivering useful application context. All events in the buffer are included in the email. The buffer will contain the most recent events of level TRACE to WARN preceding the event that triggered the email."
> https://logging.apache.org/log4j/2.x/manual/appenders.html#SMTPAppender
> The bufferSize is the number of messages preceding the message that triggered the event. They might be completely unrelated. One may not want to include them in the email at all, so having a bufferSize of 0 makes sense.
> This is however disallowed in the code:
> Caused by: java.lang.IllegalArgumentException: The maxSize argument (0) is not a positive integer.
> 	at org.apache.logging.log4j.core.util.CyclicBuffer.<init>(CyclicBuffer.java:41)
> 	at org.apache.logging.log4j.core.net.SmtpManager.<init>(SmtpManager.java:70)
> 	at org.apache.logging.log4j.core.net.SmtpManager$SMTPManagerFactory.createManager(SmtpManager.java:338)
> 	at org.apache.logging.log4j.core.net.SmtpManager$SMTPManagerFactory.createManager(SmtpManager.java:299)
> 	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:71)
> 	at org.apache.logging.log4j.core.net.SmtpManager.getSMTPManager(SmtpManager.java:124)
> 	at org.apache.logging.log4j.core.appender.SmtpAppender.createAppender(SmtpAppender.java:142)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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