logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ebersole, Steven" <steven.ebers...@vignette.com>
Subject RE: Performance between Log4j and custom in-house logger
Date Wed, 04 Sep 2002 13:05:15 GMT
SPECIFICALLY:

As Ceki mentioned you currently have logging statements being output to both
files...  this will hurt performance in this test.  Simply setting
additivity to false for the two loggers should work wonders for this simple
test.  Try this for your config:

############################################################################
###
# Define root logger/category
############################################################################
###
log4j.rootCategory=DEBUG,dest1

############################################################################
###
# Define non-root loggers/categories
############################################################################
###
log4j.category.ut.log.Log4jPerfTest=DEBUG,dest2
log4j.additivity.ut.log.Log4jPerfTest=false


############################################################################
###
# Define appenders
############################################################################
###
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.appender.dest2=org.apache.log4j.RollingFileAppender
log4j.appender.dest2.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



GENERALLY:
The way to mimic your setup in log4j would be to use AsyncAppender as your
attached appender.  This will create a background thread to handle appending
the actual logging events.

AsyncAppender can only be created from config files using the XML config.
Or you can do it programatically for your tests.

See
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/AsyncAppender.html
for its description.

Also, be aware that the async logging in log4j does still strive to maintain
delivery of generated LoggingEvents to its attached appenders in the
chronological order in which those events were created.  To this end, it
uses a bounded buffer as the "queue" for these events.  This slows
performance in simple, non-intensive apps; however it does ensure delivery
of the logging events in the correct order.

For a discussion of this see the section on AsyncAppender at
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/performance/Loggin
g.html


HTH



    |-----Original Message-----
    |From: sk k [mailto:skk7963@yahoo.com]
    |Sent: Tuesday, September 03, 2002 9:37 PM
    |To: Log4J Users List
    |Subject: Re: Performance between Log4j and custom in-house logger
    |
    |
    |
    |Hi,
    |
    |Any thoughts on how I can improve the performance
    |numbers for logging.
    |
    |
    |Thanks.
    |
    |
    |--- Ceki Gülcü <ceki@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:  
    |> <mailto:log4j-user-unsubscribe@jakarta.apache.org>
    |> >For additional commands, e-mail:
    |> <mailto:log4j-user-help@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:  
    |> <mailto:log4j-user-unsubscribe@jakarta.apache.org>
    |> For additional commands, e-mail:
    |> <mailto:log4j-user-help@jakarta.apache.org>
    |> 
    |
    |
    |__________________________________________________
    |Do You Yahoo!?
    |Yahoo! Finance - Get real-time stock quotes
    |http://finance.yahoo.com
    |
    |--
    |To unsubscribe, e-mail:   
<mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message