You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Romil Garg <Ro...@A-t-g.com> on 2008/02/15 16:26:15 UTC
Performance Issues with SMTP Appender
Hi,
I am using log4net 1.2.10 and have an application which processes around
million records on a daily basis. Recently, I added SMTP appender to it
and the running time of that process increased from 30 minutes to approx
3 hours even though the threshold value was set at WARN and I didn't log
any WARNs at all ever since I added the SMTP appender.
Removing the SMTP appender brought the running time back to 30 minutes.
Apart from SMTP, we have already been using RollingFile and EventLog
appenders with no apparent performance issues.
Here's the SMTP configuration I am using:
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<to value=myself@123.com />
<from value=${COMPUTERNAME}@123.com <ma...@123.com> />
<subject value="${COMPUTERNAME} Process ABC Error" />
<smtpHost value="localhost" />
<bufferSize value="50" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="WARN"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%newline%date [%thread] %-5level
%logger [%property{NDC}] - %message%newline%newline%newline" />
</layout>
</appender>
Any suggestions on how to avoid the performance hit and still benefit
from this appender.
Thanks.
RE: Performance Issues with SMTP Appender
Posted by Romil Garg <Ro...@A-t-g.com>.
Thanks for the prompt reply Daniel. This is how I ended up fixing it -
basically removed the evaluator and added threshold. But the only way
threshold worked was when I added bufferSize = 1 because I wanted the
process to email me immediately in case of any errors.
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<threshold value="ERROR"/>
<to value=myself@123.com />
<from value=${COMPUTERNAME}@123.com <ma...@123.com> />
<subject value="${COMPUTERNAME} Process ABC Error" />
<smtpHost value="localhost" />
<bufferSize value="1" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%newline%date [%thread] %-5level
%logger [%property{NDC}] - %message%newline%newline%newline" />
</layout>
</appender>
-----Original Message-----
From: Daniel Marohn [mailto:marohn@sipgate.de <ma...@sipgate.de>
]
Sent: Friday, February 15, 2008 10:07 AM
To: Log4NET User
Subject: Re: Performance Issues with SMTP Appender
The problem is, that you use the
evaluator type="log4net.Core.LevelEvaluator">
<threshold value="WARN"/>
</evaluator>
Every message needs to be checked if it matchs the filter.
Perhaps you can set the filterlevel inside the <logger> definition? I
guess this would speed up things.
Re: Performance Issues with SMTP Appender
Posted by Daniel Marohn <ma...@sipgate.de>.
The problem is, that you use the
evaluator type="log4net.Core.LevelEvaluator">
<threshold value="WARN"/>
</evaluator>
Every message needs to be checked if it matchs the filter.
Perhaps you can set the filterlevel inside the <logger> definition? I
guess this would speed up things.