At 12:38 PM 1/17/2004 +0000, you wrote:
Thanks for the replies. I didn't appreciate quite how dynamic log4j is.

I wonder why the log4j examples/FAQ etc don't suggest final.

Hmm... No reason why they shouldn't. I'm not sure?


What's the school of thought between the naming conventions for the logger
variable?

private static final Logger LOG = Logger.getLogger(MyClass.class);

or

private static final Logger log = Logger.getLogger(MyClass.class);

I've only ever seen the latter in use but the java code conventions suggest
capitals for constants and I'm a firm believer in sticking to the
conventions.

This is simply a matter of personal preference or a matter of following whatever code standards you choose to follow. Not really much of an issue of discussion here.


However the term "constant" is not well defined in the code conventions.

Is a constant any final variable (a constant reference) or is a constant
only a final variable that is immutable (constant value)?

I would suggest the latter. A constant is a final variable which is immutable. As such, creating a final Logger is not equivalent to creating a constant.


I ask on this list because _if_ the log4j documentation changes to include a
final example then it should be keeping to conventions also.

The code in Log4j formatted in such a way to enforce a modified version of the Sun coding conventions. You can take a look there to what those conventions are. If you see any Log4j docs that don't agree with what is enforced in the code, speak up. Better yet, provide a patch correct it.


Jake


----- Original Message -----
From: "Shapira, Yoav" <[EMAIL PROTECTED]>
To: "Log4J Users List" <[EMAIL PROTECTED]>
Sent: Friday, January 16, 2004 5:37 PM
Subject: RE: Absolute performance



Howdy,

>private static final Logger LOG = Logger.getLogger(MyClass.class);

This is good and I do it as well as recommend it to others.

>private static final boolean DEBUG_ENABLED = LOG.isDebugEnabled();

This is not good because isDebugEnabled potentially changes with time
during a program's execution, and that's one of log4j's main features.

Yoav Shapira



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]


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


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



Reply via email to