logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Adams <jad...@ucar.edu>
Subject Failure to create log file upon initialization
Date Thu, 14 Mar 2002 02:06:31 GMT

I have a web application which is uses Log4j for the logging of error
and debugging information.  I am using Apache/Tomcat 4 to serve my
application which is JSP/Servlet based.

The web application is correctly initializing and creating the log file
on a production machine which is also running Tomcat 4.  However when I
run the application on my development machine I don't get the automatic
creation of the log file when I start the application or restart
Tomcat.  So my logging

I have recently reinstalled Tomcat on my development machine so perhaps
there is something that I forgot to do in the configuration of Tomcat on
that machine ?  I guess this is most likely since everything works on
one server and not on another, both of which are running Tomcat 4.

Some info which might give some insight follows.

The log4j-core.jar and log4j.jar files are both in WEB-INF/lib.

I don't see any errors associated with Log4j in the
$CATALINA_HOME/logs/localhost.txt file, only messages such as

2002-03-13 18:08:44 log4j-init: init

I have the following as my log4j.properties file, which is in


# Set root category priority to DEBUG and its only appender to A1.
log4j.rootCategory=DEBUG, A1

# A1 is set to be a RollingFileAppender.


# Keep one backup file

# A1 uses PatternLayout.
log4j.appender.A1.layout.ConversionPattern=%5p %d (%F:%L) - %m%n


I have the following as the first entry in my web.xml:




My servlet which does the initialization has the following init()


public void init()
        // gets the base directory to use, from the web application's
        String prefix = getServletContext().getRealPath("/");

        // this looks in the web.xml for the initialization file
        String file = getInitParameter("log4j-init-file");

        // if the log4j-init-file is not set, then no point in trying
        if (file != null)
            // apply the configuration specified in the initialization
            PropertyConfigurator.configure(prefix + file);


Any suggestions or help of any sort will be greatly appreciated.


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

View raw message