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 sk k <sk...@yahoo.com> on 2002/09/03 16:29:32 UTC

Performance between Log4j and custom in-house logger

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Performance between Log4j and custom in-house logger

Posted by sk k <sk...@yahoo.com>.
Hi,

Any thoughts on how I can improve the performance
numbers for logging.


Thanks.


--- Ceki G�lc� <ce...@qos.ch> wrote:
> 
> What is the difference between Strings, taking the
> values 2,4 and 8,
> and Request, taking the values 100, 1000 and 2000?
> 
> Are you sure you are waiting for the background
> thread to finish?
> 
> Your log4j configuration file suggests that your
> tests use two
> appenders dest1 and dest2. You are aware that
> appenders are additive,
> right?  Does logging output go both
> c:/skk/cps/logger/test/test1.log
> and c:/skk/cps/logger/test/test.log? Given that
> writing to a file is
> the most time consuming task, is it fait to say that
> log4j is doing
> twice the work roughly at the same cost?
> 
> At 07:29 03.09.2002 -0700, you wrote:
> >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:  
> <ma...@jakarta.apache.org>
> >For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> Ceki
> 
> TCP implementations will follow a general principle
> of robustness: be
> conservative in what you do, be liberal in what you
> accept from
> others. -- Jon Postel, RFC 793
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Performance between Log4j and custom in-house logger

Posted by sk k <sk...@yahoo.com>.
Hi,

We want to move to log4j and that is the reason why 
we are doing the POC.

I really like log4j(features and functionality ) and
wanted to push the usage of log4j in the entire
organization.
I need some input from guru's to see how I can improve
the performance numbers since the decision is not made
by me. I need to put together the pro's, con's and
performance numbers and present it to somebody who 
will go over the facts and make a decision.


Is there any changes in code or config settings that
will enable me to get better performance numbers. The
functionality and features offered by log4j are
awesome.

Let me give some explaination of the perf numbers with
2 strings( array size = 2).

1) The contents of the string is as shown below
My Sample String:
================
String msg[] = {"2-Aug-2002:08:21:30.568  xxxxxx    
136.503    debug    useThread: idle count is 19",
"12-Aug-2002:08:21:30.568  xxxxxxx      136.483   
debug    stats: intf FCOPingInterface" };

Pls note that the strings are some arbitrary values.

2) Now I call test_log4j method 100 times ( so it is
100 req) and gather the time
    Repeat the above test with 1000 requests and
gather the time
    Repeat the above test with 2000 requests and
gather the time

Thats how the timing stats are gathered.

>> Appender additivity is turned off as per by config
setting and I don't see
   any log messages written to test1.log either.

>> Sorry, I didn't understand your question about
waiting for background thread.


--- Ceki G�lc� <ce...@qos.ch> wrote:
> 
> What is the difference between Strings, taking the
> values 2,4 and 8,
> and Request, taking the values 100, 1000 and 2000?
> 
> Are you sure you are waiting for the background
> thread to finish?
> 
> Your log4j configuration file suggests that your
> tests use two
> appenders dest1 and dest2. You are aware that
> appenders are additive,
> right?  Does logging output go both
> c:/skk/cps/logger/test/test1.log
> and c:/skk/cps/logger/test/test.log? Given that
> writing to a file is
> the most time consuming task, is it fait to say that
> log4j is doing
> twice the work roughly at the same cost?
> 
> At 07:29 03.09.2002 -0700, you wrote:
> >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:  
> <ma...@jakarta.apache.org>
> >For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> Ceki
> 
> TCP implementations will follow a general principle
> of robustness: be
> conservative in what you do, be liberal in what you
> accept from
> others. -- Jon Postel, RFC 793
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Performance between Log4j and custom in-house logger

Posted by Ceki Gülcü <ce...@qos.ch>.
What is the difference between Strings, taking the values 2,4 and 8,
and Request, taking the values 100, 1000 and 2000?

Are you sure you are waiting for the background thread to finish?

Your log4j configuration file suggests that your tests use two
appenders dest1 and dest2. You are aware that appenders are additive,
right?  Does logging output go both c:/skk/cps/logger/test/test1.log
and c:/skk/cps/logger/test/test.log? Given that writing to a file is
the most time consuming task, is it fait to say that log4j is doing
twice the work roughly at the same cost?

At 07:29 03.09.2002 -0700, you wrote:
>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:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>