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 "Drapeau, Tom" <TD...@hotjobs.com> on 2004/02/28 00:29:10 UTC

Performance problems when using log4j v1.2.8

Hi there,

I recently installed log4j on a FreeBSD system and have been playing with various options trying to improve the performance of the SMTPAppender.

I have attached my log4j.properties file below.

The SyslogAppender is running rougly 1-3ms per log, but the SMTPAppender is taking 130-140ms per log. I am running qmail locally, so am using SMTP on localhost:25.

Any ideas as to how I can improve performance here?

I'm running JavaMail v1.3.1 with JAF v1.0.2.

Thanks in advance for your help.
Tom

-- log4j.properties --

log4j.rootLogger=DEBUG, A1, A2, A3

log4j.appender.A1=org.apache.log4j.ConsoleAppender

log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%r %d [%t] %-5p %c - %m%n

log4j.appender.A2=org.apache.log4j.net.SyslogAppender
log4j.appender.A2.SyslogHost=localhost

log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=<LOG_%-5p> %c{1} %M.%L %x - %m%n

log4j.appender.A3=org.apache.log4j.net.SMTPAppender
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=%-5p %c{1} %M.%L %x - %m%n

log4j.appender.A3.SMTPHost=localhost
log4j.appender.A3.To=foo@bar.com
log4j.appender.A3.Subject=Error from host

Re: Performance problems when using log4j v1.2.8

Posted by Paul Smith <pa...@lawlex.com.au>.
On Sat, 2004-02-28 at 10:29, Drapeau, Tom wrote:
> Hi there,
> 
> I recently installed log4j on a FreeBSD system and have been playing
> with various options trying to improve the performance of the
> SMTPAppender.
> 
> I have attached my log4j.properties file below.
> 
> The SyslogAppender is running rougly 1-3ms per log, but the SMTPAppender
> is taking 130-140ms per log. I am running qmail locally, so am using
> SMTP on localhost:25.

Are you measuring the cost of the actual LOGGING or the actual Logging &
Sending?  Since the SMTPAppender usually doesn't do any transmitting via
SMTP until the trigger determines that it should, most logging via this
appender should be snappy as all it is doing is adding to a buffer and
evaluating the trigger.  Do you have any method-level performance
statistics (via say, OptimizeIt or equiv) that can point the finger?  

We would expect the actual SMTP-ing to not be snappy, but the storing in
the buffer and evaluating the trigger should be very quick.  Used in the
traditional way, the SMTPAppender rarely does any SMTP-ing (it's waiting
for an error to trigger the sending).

cheers,

Paul Smith


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