commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: commons logging class level logging
Date Fri, 25 Mar 2005 23:35:35 GMT
On Thu, 24 Mar 2005 13:42:04 -0700, Trenton D. Adams
<> wrote:
> I thought I read somewhere that JCL allows one to turn on/off debug
> logging based on the package or class name.  Is that right?  I'm looking
> on the JCL website, but can't find information on that.  Perhaps that's
> because I don't know what to search for!

Well, that's probably because configuring the underlying logging
system is something external to JCL (i.e. look at the configuration
docs for JDK logging or Log4J logging, or whatever).

That being said, there is a lot of code in the world (including a very
large amount of the Java code at Apache that does logging) which
follows a convention to name your "log" implementation for a
particular class after the fully qualified classname of that
implementation class.  Further, it is a common convention for logging
systems (in particular, JDK logging and Log4J do this) to support
"hierarchical" configuration that allows you to specify a general
configuration for a package, but detailed exceptions for lower level

Consider Struts, which follows the naming convention.  All classes in
Struts are in package org.apache.struts (or a subpackage like
org.apache.struts.action).  Now, assume you're using JDK logging (so
you edit $JAVA_HOME/jre/lib/ to configure it).  I
can have the following lines:

  # Set the general logging level for Struts code to INFO
  org.apache.struts.level = INFO

  # But I want debug level messages from RequestProcessor
  org.apache.struts.action.RequestProcessor.level = FINE

  # And trace level messages from ModuleUtils

You can do the same sort of thing with Log4J by following its
configuration rules.


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

View raw message