commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Configuring jdk14 logging under tomcat
Date Sun, 17 Aug 2003 02:07:13 GMT
On Thu, 14 Aug 2003, Eric Giguere wrote:

> Date: Thu, 14 Aug 2003 15:00:41 -0400
> From: Eric Giguere <eric.giguere@videotron.ca>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: commons-user@jakarta.apache.org
> 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()
  yourself.

> Meanwhile, commons-logging.properties in WEB-INF/classes and
> simplelog.properties 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

Craig

Mime
View raw message