tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sloan Seaman" <>
Subject Re: Log4J and tomcat
Date Thu, 13 Feb 2003 18:29:29 GMT
This is what I have defined at the beginning (could be causing the problem?)

    private static final Log log = LogFactory.getLog(Initializer.class);

The log factory is the org.apache.commons.logging.LogFactory.

This is what I have in a servlet that gets preloaded...

  String log4jFile = _config.getInitParameter("LOG4J_FILE");
  if (log4jFile == null) throw new ServletException("Parameter LOG4J cannot
be null");
  DOMConfigurator.configureAndWatch(log4jFile);"Log configured");

You would think that would do it but the line gets sent to Tomcat's
console screen and not to the file that I have defined...

I do not have the log4j file in my war because I want to be able to
dynamically change the log msg levels without having to re-deploy...

I also had trouble with Tomcat not finding the log4j.dtd in the log4j
jar....  I had to extract it from the jar and put it somewhere...

----- Original Message -----
From: "Ron Day" <>
To: "Tomcat Users List" <>
Sent: Thursday, February 13, 2003 1:15 PM
Subject: RE: Log4J and tomcat

> Try putting log4j.jar in your WEB-INF/lib directory, and your log4j.props
> your classes directory.
> or
> set up a servlet that loads on startup that uses the log4j method to
> the path to your prop file, in the init().
> -----Original Message-----
> From: Sloan Seaman []
> Sent: Wednesday, February 12, 2003 3:23 PM
> To:
> Subject: Log4J and tomcat
> I'm deploying a war file using tomcat and I wish to use Apache's common
> logging api to log things (log4j behind the scenes).
> For some reason my configuration file seems to be getting ignored but my
> msgs are showing up in the console window for Tomcat.
> Can someone tell me why this is happening?
> How do I get my app to use my log4j conf file?
> Thanks!
> --
> Sloan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message