commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: [JCL] Logging for specific classes
Date Sat, 22 Apr 2006 04:12:26 GMT
On Sat, 2006-04-22 at 00:00 -0400, Frank W. Zammetti wrote:
> Ah, ok, so then a logger is named after the package of the class it is 
> defined in?  If xxxx is the name of the logger, as the docs say, that 
> would make sense (and that would also be the missing piece of the puzzle 
> I needed to understand that, because I had read those docs before).

No, a logger can be named anything at all.

As a convenience, a Class can be passed in which case the name =
class.getName(). Log objects don't have to have names which match the
class they are used by, but it's a very common convention.

In 99% of cases, when loggers are created they are created by passing a
Class object, ie have name of the class that created them.

public Widget {
  // log has name(aka category) of
  private Log log = LogFactory.getLog(Widget.class);

  // special log object for issuing messages that can be
  // filtered/written using rules different from the ones
  // for class-specific log messages.
  private Log sysAdminLog = LogFactory.getLog("sysadmin-alerts");



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message