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/

Attachment: log4jnotlogging.zip
Description: log4jnotlogging.zip

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

Reply via email to