I usually like to declare them private static final. Private because I
don't want any other class accessing the logger, and static final to
keep it "separate" from the class instances.

The exception being when you are subclassing, then it is useful to
declare the logger on the superclass like this:

private Logger log = Logger.getLogger(getClass());

That way, if you execute an inherited method, the log appears as
coming from your own class and not from the superclass.

On 6/13/06, Konstantinos Karadamoglou <[EMAIL PROTECTED]> wrote:
Hello all,

Which is the best practice of declaring Loggers? For instance, should they
be static, private, final? and why?

Thank you in advance, Kostas




--
Javier González Nicolini

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

Reply via email to