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.info("Log configured");

You would think that would do it but the log.info 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" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
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
in
> your classes directory.
> or
> set up a servlet that loads on startup that uses the log4j method to
define
> the path to your prop file, in the init().
>
> -----Original Message-----
> From: Sloan Seaman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 12, 2003 3:23 PM
> To: [EMAIL PROTECTED]
> 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
> log.info 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to