commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Giguere" <>
Subject RE: Configuring jdk14 logging under tomcat
Date Tue, 19 Aug 2003 14:48:41 GMT
Hi Craig

Euh, can I say here that I'm honored to have you answering one of my
questions. I'm following with great interest all your work on both Tomcat,
Struts and particulary on the standardization efforts for the Java Server

Yes, its been quite clear in all the documentation that the configuration of
the underlying log engine encapsultated by commons-logging is up to the
programmer, using the underlying mechanism to do so. But since there is
already a dependancy between commons-logging and Jdk1.4 logging package, I'm
wondering if it would be desirable to add some pre-coded configuration
mechanism in the Jdk14Logger, something like using of a property file like
the mechanism coded in the static initializer of the SimpleLog class for

If not, like you mentionned, coding the LogManager.readConfiguration() in
the ServletContextListener do the trick. Adding a search for the property
file ( the like ) and calling this
method with the found file, would it be a violation of the philosophy of

Thx again.

-----Original Message-----
From: Craig R. McClanahan []
Sent: August 16, 2003 10:07 PM
To: Jakarta Commons Users List
Subject: Re: Configuring jdk14 logging under tomcat

On Thu, 14 Aug 2003, Eric Giguere wrote:

> Date: Thu, 14 Aug 2003 15:00:41 -0400
> From: Eric Giguere <>
> Reply-To: Jakarta Commons Users List <>
> To:
> Subject: Configuring jdk14 logging under tomcat
> Hi all
> I've search for the last hour to get a way to configure the jdk1.4
> logging facility when used from the commons-logging, all this running
> under Tomcat 4.1.24
>  From jdk doc, we can either call configure() method (cannot), modify
> system wide config file (don't want) of supply a config file path as a
> JVM system property. I've not found how to do so on web-application
> startup, using web.xml tags <env-entry> and <context-param> failed... Or
> did I miss something?
> My question is then, is it possible to configure the jdk1.4 logging
> engine used from commons-logging in a web application context? If so,
> anybody can help with some general advice?

The two basic mechanisms for configuring JDK 1.4 logging (similar in
philosphy to other logging implementations) are programmatic setup and
configuration file processing, so those are your two basic choices.

* For programmatic setup, you'll want to acquire the LogManager
  instance and perform the appropriate configuration.  In a webapp,
  it's probably best to do this sort of thing in a ServletContextListener
  if you're on a Servlet 2.3 container (which includes Tomcat 4.1.x).

* For configuration-based setup, you can specify the appropriate config
  files via system properties or by calling LogManager.readConfiguration()

> Meanwhile, in WEB-INF/classes and
> in same location allowed me to get debug messages.

The general philosophy of commons-logging is that configuration of the
underlying logging implementation should be done through that
implementation's normal facilities.  Since SimpleLog *is* a logging
implementation, it offers its own ability to configure itself, but if you
want to use JDK 1.4 or Log4J logging, you'll need to use the standard
configuration facilities provided by those systems.

> Any help appreciated
> thx
> Eric


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

View raw message