Hi,

We are planning to move from a custom in house logging
framework (MyLogger) to using Log4j and have been
doing some performance comparison between log4j and
MyLogger.

The numbers seem to be favoring mylogger over log4j.


Sample Numbers
==============
Note: Timing includes logj startup time, mylogger
startup time and junitperf startup time.

1) Logging 2 strings, each of size: 128bytes 

Request MyLogger(sec) Log4j(sec)
======  =======       =========
100     1.22    1.29
1000    1.67    1.71
2000    2.12    2.01



2) Logging 4 strings, each of size: 128bytes 
   
Request MyLogger(sec) Log4j(sec)
======  =======       =========
100     1.21    1.25
1000    1.653   1.82
2000    2.24    2.56


3) Logging 8 strings, each of size: 128bytes 

Request MyLogger(sec) Log4j(sec)
======  =======       =========
100     1.35    1.35
400     1.56    1.71
900     1.8     2.35

4) Logging 80 strings, each of size: 128bytes 

Request MyLogger(sec) Log4j(sec)
======  =======       =========
100     1.251   1.7
1000    1.81    6.1
2000    2.15    11.2


Sample code and configuration
===========================
log4j.properties
==============
log4j.rootCategory=DEBUG,dest1

log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.layout=org.apache.log4j.SimpleLayout
log4j.appender.dest1.File=c:/skk/cps/logger/test/test1.log
log4j.appender.dest1.MaxFileSize=4MB
log4j.appender.dest1.MaxBackupIndex=60


log4j.category.ut.log.Log4jPerfTest=DEBUG,dest2
log4j.additivity.Log4jPerfTest=false
log4j.appender.dest2=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.layout=org.apache.log4j.TTCCLayout

log4j.appender.dest2.File=c:/skk/cps/logger/test/test.log
log4j.appender.dest2.MaxFileSize=4MB
log4j.appender.dest2.MaxBackupIndex=60

Test Logger code
===============

Note: logMsgs is an array with strings of size 128
bytes.

   public void test_Log4j() throws Exception {
        
        int size = logMsgs.size();

        for( int i=0; i<size; i++ ) {
            log4jLogger.info( (String)logMsgs.get(i)
);
        }

    }

Some of my questions

1) Is there anything that I can do to increase the
performance of log4j on my box( Pentium-3, 800Mhz,
512MB RAM)

2) I see some architectural difference between the way
mylogger and log4j is implemented namely 
 My logger does formatting&writing to log file in a
background thread whereas it seems that log4j doesn't 
 seem do the same. Is this true. 
 My logger uses the concept of observer and
observable.


Thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to