[slf4j-user] Release of SLF4J version 1.5.9-RC0

Ceki Gulcu ceki at qos.ch
Sat Sep 5 14:55:43 CEST 2009


Two bits of information should answer your question.

  1) A LocLogger *is* a Logger and can be used as such.
  2) When you write

  Logger lx = LoggerFactory.getLogger("X");
  LocLogger llx = llFactory.getLocLogger("X");

then "llx" is actually a wrapper around that very "lx". (llx wraps that very 
specific "lx").

So, if in a given class you are doing both regular and localized logging, the 
LocLogger is sufficient for both needs.

ekkehard wrote:
> thx for info...
> seems I have to create an extra blog for localized logging in my current 
> blog series about
> logging in osgi enterprise applications ;-) 
> http://ekkescorner.wordpress.com/blog-series/osgi-apps/

Getting the word out on CAL10 would be highly welcome.

> another question:
> localized log messages makes much sense for systems running at customer 
> site,
> but while developing and using DEBUG levels the messages usually will be 
> only in english
> 
> does this mean I need two loggers for each class ?

No. Two bits of information should clarify the point.

  1) A LocLogger *is* a Logger and can be used as such.
  2) When you write

  Logger lx = LoggerFactory.getLogger("X");
  LocLogger llx = llFactory.getLocLogger("X");

then "llx" is actually a wrapper around that very "lx". (llx wraps that very 
specific "lx").

So, if in a given class you are doing both regular and localized logging, the 
LocLogger is sufficient for both needs.

> logger.debug(...my debug messages with parameters...)
> and
> locLogger(...my info, warn, error ENUM messages...)
> 
> or will the underlying Logback system only use one Logger if the name is 
> the same ?
> 
> whats the recommended way to do logging with enums and without in the 
> same class ?

A LocLogger should cover both needs. However, it is possible that a class needs 
to do logging before it has a chance to get a handle on a LogLoggerFactory, in 
that case, a regular Logger would be used.

> thx
> 
> ekke
> 
-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list