Hi CC,

I also wanted to have them in WEB-INF. The following code works 
for me (TC 4.0.4). You can even rename the log4j.properties to 
whatever you want. This solution is supposed to work in not 
expanded wars, too.

    InputStream log4jPropsIn = 
getServletContext().getResourceAsStream("WEB-INF/log4j.properties");
    if (log4jPropsIn == null)
    {
      // Set up a simple configuration that logs on the console.
      BasicConfigurator.configure();      
    }
    else
    {
      Properties logProps = new Properties();
      try
      {
        logProps.load(log4jPropsIn);
        // BasicConfigurator replaced with PropertyConfigurator.
        PropertyConfigurator.configure(logProps);
      }
      catch (IOException io)
      {
        // Set up a simple configuration that logs on the console.
        BasicConfigurator.configure();      
      }
    }//else
      logger.info("log4j configuration finished");

Good luck.

Andreas

On 23 Oct 2002 at 10:29, Carson, Chuck wrote:

> 
> I am using log4j and have the log4j.jar file located in
> $TOMCAT_HOME/webapps/<myapp>/WEB-INF/classes. For some reason, I can
> only place the log4j.properties file in the same directory as the jar
> file. Is this proper behavior? I would like to keep the log4j.properties
> file in WEB-INF/.
> 
> Thanks for any help
> CC
> 
> 
> ----------
> This message contains confidential information and is intended only for
> the individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
> delete this e-mail from your system. E-mail transmission cannot be
> guaranteed to be secure or error-free as information could be
> intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
> contain viruses. The sender therefore does not accept liability for any
> errors or omissions in the contents of this message, which arise as a
> result of e-mail transmission. If verification is required please
> request a hard-copy version. 
> 


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to