Yeah, I think you are right, it's not read at all. But how?

In my case(since I am using Struts), I thought the action servlet initializes
the log4j system automatically.  And it reads the <init-param> in the webapp's
web.xml to find the property file.  Am I totally off?   Why would you call it
'init-param' if it's not used for initialization.

Now I don't get any thing except the console output when I run the following
test code(I got the following test code from the log4j tutorial), not even
warnings.  Darn, I cannot believe I am stuck on such a simple matter!

--------------
import java.util.Date;
import org.apache.log4j.Logger;
import org.apache.log4j.BasicConfigurator;

public class Log4JTest
{
    // Define a static logger variable so that it references the
    // Logger instance named "Log4JTest".
    static Logger logger = Logger.getLogger(Log4JTest.class);

    public static void main(String[] args)
    {

        // Set up a simple configuration that logs on the console.
        BasicConfigurator.configure();

        logger.info("Entering application.");
            System.out.println("program executing");
        logger.info("Exiting application.");
        
        logger.warn("Entering application that has deprecated methods");
        System.out.println(new Date(1991, 1, 2));
        logger.warn("Exiting application that has deprecated methods");
        
        logger.debug("Debugging a program");
        System.out.println("have bugs");
        logger.debug("Finishing debugging");

        //BasicConfigurator.resetConfiguration();
        //logger.debug("debugging");        
    }



-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 29, 2004 12:13 PM
To: Tomcat Users List
Subject: RE: log4j config problem



Howdy,

>Before I had my log4j.properties file under 'WEB-INF/classes/', and in
the
>'web.xml' everything worked fine when I had
>
>    <init-param>
>      <param-name>log4j-config</param-name>
>      <param-value>/WEB-INF/classes/log4j.properties</param-value>
>    </init-param>

Your init-param might not have been read (I don't know what servlet
you're using to initialize log4j), and the log4j default process looks
in WEB-INF/classes but not WEB-INF.

Yoav Shapira



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to whom
it is addressed, and may not be saved, copied, printed, disclosed or used by
anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
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