Yoav,

Thanks for the reply.  The test was iterating 10
million times so that the performance could be
measured - its not that I am actually planning to log
that often.

I am aware that I can apply these checks before
logging however I would prefer if I didn't have to add
them everywhere I am logging in my code.  

Would there be a way where these checks could be
included in Log4J itself - thereby preventing the
overhead of having to write checks everywhere.

David

--- "Shapira, Yoav" <[EMAIL PROTECTED]> wrote:
> 
> Howdy,
> This is why you surround your code in isInfoEnabled
> / isDebugEnabled /
> isEnabledFor clauses if you're going to have
> millions of logging
> statements.  That has the potential to reduce the
> cost of (not) logging
> by two orders of magnitude.
> 
> Yoav Shapira
> Millennium ChemInformatics
> 
> 
> >-----Original Message-----
> >From: David McVicar [mailto:[EMAIL PROTECTED]
> >Sent: Wednesday, October 29, 2003 9:21 AM
> >To: [EMAIL PROTECTED]
> >Subject: Performance of not logging in Log4J vs.
> JDK 1.4 Logging
> >
> >Hi,
> >
> >I have written a basic test to exercise the effect
> of
> >adding logging to an application but configuring no
> >logging to be output.  The test consists of some
> JUnit
> >tests that repeatedly call both the Log4J and JDK
> 1.4
> >Logger.log(Level.INFO, "Hello") method 10million
> times
> >(its just a test so please don't flame me for using
> >Property to pass the loopCount!).  The tests are
> >configured using log4j.xml (Log4J) and
> >logging.properties (JDK 1.4).  I used the JUnitPerf
> >classes from Clarkware.com to measure the
> performance.
> >
> >Unforunately I have found that Log4J 1.2.8 took
> 2023ms
> >while JDK 1.4.2 took only 892ms.
> >
> >The performance while not logging is a concern in
> my
> >application.  I am aware that I could instrument
> the
> >generated byte code using Just4Log but would prefer
> >not to add a post compilation step.
> >
> >I have read through the code and it appears that
> the
> >effort of evaluating the
> priority.isGreaterOrEqual()
> >is where the time is being lost.
> >
> >  public
> >  void log(Priority priority, Object message) {
> >    if(repository.isDisabled(priority.level)) {
> >      return;
> >    }
> >
>
>if(priority.isGreaterOrEqual(this.getEffectiveLevel()))
> >      forcedLog(FQCN, priority, message, null);
> >  }
> >
> >Would it be possible during configuration of Log4J
> >that a flag be set to disable the entire repository
> if
> >all of the Categories are turned OFF?
> >
> >Although I think that I have configured both Log4J
> and
> >JDK 1.4 not to log using a specific class name the
> >costs of not logging are greater in Log4J.  I may
> >however have made an error in my configuration - if
> so
> >I apologise in advance.
> >
> >I have enclosed the tests for reference.
> >
> >I have been a user of Log4J for about 3 years and
> >would like to say a quick thanks for all of your
> good
> >work.
> >
> >Thanks in advance for any assistance you can
> provide
> >in improving the performance of Log4J.
> >
> >David
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Exclusive Video Premiere - Britney Spears
> >http://launch.yahoo.com/promos/britneyspears/
> 
> 
> 
> This e-mail, including any attachments, is a
> confidential business communication, and may contain
> information that is confidential, proprietary and/or
> privileged.  This e-mail is intended only for the
> individual(s) to whom it is addressed, and may not
> be saved, copied, printed, disclosed or used by
> anyone else.  If you are not the(an) intended
> recipient, please immediately delete this e-mail
> from your computer system and notify the sender. 
> Thank you.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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

Reply via email to