Hi,
I did the test with AsyncAppender using an xml config file(set the buff size to 1000 even though default size of 128 should be sufficient. My logger uses a size of like 60 ) and it seems the performance isn't any better. Infact the performance dropped a little and it seems to vaildate the AsyncAppender performance numbers shown in the javadocs. Pls let me know if anything is wrong or needs to be tuned. config file: ============= <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true" > <appender name="dest1" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="c:/skk/cps/logger/test/test1.log"/> <param name="MaxFileSize" value="4MB"/> <param name="MaxBackupIndex" value="2"/> <layout class="org.apache.log4j.TTCCLayout"/> </appender> <appender name="dest2" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="c:/skk/cps/logger/test/test2.log"/> <param name="MaxFileSize" value="4MB"/> <param name="MaxBackupIndex" value="2"/> <param name="BufferSize" value="1000"/> <layout class="org.apache.log4j.TTCCLayout"/> </appender> <category name="ut.log.Log4jPerfTest" additivity="false"> <priority value="debug"/> <appender-ref ref="dest2"/> </category> <root> <priority value="DEBUG"/> <appender-ref ref="dest1"/> </root> </log4j:configuration> I am measuring the time when the method starts and and when it returns and it seems that the background task time is not accounted for using my logger and it is accounted for while using log4j. It seems that application shouldn't wait till the log message has been written as it would degrade peformance . Here is the config values for writing to 3 appenders ## # Default logger ## log4j.rootCategory=DEBUG,dest1 ## # Non-Default settings ## log4j.category.ut.log.Log4jPerfTest=DEBUG,dest2,dest1, dest3 log4j.additivity.ut.log.Log4jPerfTest=false log4j.appender.dest1=org.apache.log4j.RollingFileAppender log4j.appender.dest1.layout=org.apache.log4j.TTCCLayout log4j.appender.dest1.File=c:/skk/cps/logger/test/test1.log log4j.appender.dest1.MaxFileSize=4MB log4j.appender.dest1.MaxBackupIndex=2 log4j.appender.dest2=org.apache.log4j.RollingFileAppender log4j.appender.dest2.layout=org.apache.log4j.TTCCLayout log4j.appender.dest2.File=c:/skk/cps/logger/test/test2.log log4j.appender.dest2.MaxFileSize=4MB log4j.appender.dest2.MaxBackupIndex=2 log4j.appender.dest3=org.apache.log4j.RollingFileAppender log4j.appender.dest3.layout=org.apache.log4j.TTCCLayout log4j.appender.dest3.File=c:/skk/cps/logger/test/test3.log log4j.appender.dest3.MaxFileSize=4MB log4j.appender.dest3.MaxBackupIndex=2 Any thoughts or comments? --- Ceki Gülcü <[EMAIL PROTECTED]> wrote: > At 11:13 04.09.2002 -0700, you wrote: > > >I made the changes mentioned and still the > performance > >has increased by only 10-50% but still my custom > >logger > >results are ahead of log4j. > > Do the test with a AsyncAppender BufferSize of > 20'000. You'll be > logging at "no time" at all. (This statement is very > misleading, read > below.) > > >Also measured the cpu and memory and it seems my > >custom logger is consuming lesser values since > >formatting and writing to file is done in the > >background. > > > As others explained previously, back grounding tasks > does not > necessarily result in better performance. To give > you an example, when > Alice asks her secretary, Bob, to type a letter, > Alice's job is done > after she delegates to Bob. However, that does not > mean that the > letter has been typed. Are you sure you are not > measuring the time it > takes Alice to delegate as opposed to Bob actually > typing the letter? > > >I did some more testing on writting to multiple > >appenders and my custom logger is like 10-300% > faster > >than log4j. > > Where is the code? > > >Are there any plans to re-write log4j (any next > >generation version). It seems that log4j needs > >an architectural change rather than anything else. > > I wouldn't jump the gun if I were you. :-) > > >Any ideas? > > > >--- "Ebersole, Steven" > <[EMAIL PROTECTED]> > >wrote: > > > 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:[EMAIL PROTECTED]] > > > |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ü <[EMAIL PROTECTED]> 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 > === message truncated === __________________________________________________ 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]>