Hi,

The private usage works for me. Here's my preferred way:

public class SomeClass {

private final static String VERSION = "$Id$"; // CVS version string
private final static String CLASS = SomeClass.class.getName(); // FQ Class name

// define the Loggers

private final static Logger LOGGER_init = Logger.getLogger(CLASS + ".<init>");
private final static Logger LOGGER_doStuff = Logger.getLogger(CLASS + ".doStuff");
private final static Logger LOGGER_doMoreStuff = Logger.getLogger(CLASS + 
".doMoreStuff");

// now the methods

public void doStuff() {
  Logger logger = LOGGER_doStuff;
  logger.info("Hello World");
}

public void doMoreStuff() {
  Logger logger = LOGGER_doMoreStuff;
  logger.info("Hello World");
}

}

Best,

        -- David


--On Friday, October 01, 2004 9:56 AM +0100 [EMAIL PROTECTED] wrote:





Hi all

just a little question.
In all log4j examples I see the logger is integrated as

public static Logger logger = new Logger(x.class);

If I understand it correct, it is static to enhance the performance, as
only one instance of the logger is used for all instantiations of class x.
But why is it public? I would make it private as it is referenced only in
the class x, not outside.

And if i don't want to extend the class x, I would make it final.

Thus in my example it would be:
private static final Logger logger = new Logger(x.class);

Are there any arguments speaking against this usage? Please make
suggestions.

Thanks Herb

--
Diese E-Mail enth�lt vertrauliche und/oder rechtlich gesch�tzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrt�mlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail oder von Teilen dieser Mail ist nicht gestattet.

Wir haben alle verkehrs�blichen Ma�nahmen unternommen, um das Risiko der
Verbreitung virenbefallener Software oder E-Mails zu minimieren, dennoch
raten wir Ihnen, Ihre eigenen Virenkontrollen auf alle Anh�nge an dieser
Nachricht durchzuf�hren. Wir schlie�en au�er f�r den Fall von Vorsatz oder
grober Fahrl�ssigkeit die Haftung f�r jeglichen Verlust oder Sch�den durch
virenbefallene Software oder E-Mails aus.

Jede von der Bank versendete E-Mail ist sorgf�ltig erstellt worden, dennoch
schlie�en wir die rechtliche Verbindlichkeit aus; sie kann nicht zu einer
irgendwie gearteten Verpflichtung zu Lasten der Bank ausgelegt werden.
______________________________________________________________________

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of  the material in this
e-mail or of parts hereof is strictly forbidden.

We have taken precautions to minimize the risk of transmitting software
viruses but nevertheless advise you to carry out your own virus checks on
any attachment of this message. We accept no liability for loss or damage
caused by software viruses except in case of gross negligence or willful
behaviour.

Any e-mail messages from the Bank are sent in good faith, but shall not be
binding or construed as constituting any kind of obligation on the part of
the Bank.


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






-- David Tonhofer

  M-PLIFY S.A.
  Resp. Informatique
  47, av. de la Libert�
  L-1931 Luxembourg
  Tel: +352 261846-52
  Fax: +352 261846-46
  Mob: +352 021-139031



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



Reply via email to