logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Performance and Logger.getLogger()
Date Wed, 02 Apr 2003 14:29:29 GMT

Howdy,

>  Currently I have a call to Logger.getLogger() in every class and the
>returned Logger is stored in a static field.  This is not the common way
>to acquire a logger?

This is the common way, and it's fine.  You're doing this one time.

The situation he was talking about is different.  He's writing a logging fa├žade, which will
have methods like:

public static log(Class clazz, String message) {
  ...
}

And his question was about the cost of doing Logger.getLogger(clazz.getName()) each and every
time inside the above method.  That can indeed get expensive.  It's like if you were doing
Logger.getLogger() not in a static initializer, but every single time you needed to log something.

Yoav Shapira
Millennium ChemInformatics



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


Mime
View raw message