logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantinos Karadamoglou" <kka...@googlemail.com>
Subject Re: Best practice on declaring Loggers
Date Tue, 13 Jun 2006 14:05:44 GMT
What about shared classes that operate in a server environment should be log
using static Loggers? Is there any implication when doing that?

Thanks, Kostas

On 13/06/06, Konstantinos Karadamoglou <kkarad@googlemail.com> wrote:
>
> thank you Javier!
>
>
> On 13/06/06, Javier Gonzalez <jagonzal@gmail.com> wrote:
> >
> > 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 <kkarad@googlemail.com> 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: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message