At 19:06 13.03.2002 -0700, you wrote:
>Hello,
>
>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.

To the best of my knowledge Tomcat does not use log4j and does
not need to be configured for log4j.

>Some info which might give some insight follows.
>
>The log4j-core.jar and log4j.jar files are both in WEB-INF/lib.

You do not need both log4j-core.jar and log4j.jar. Use log4j.jar only.

>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

Where does this log entry come from?

>I have the following as my log4j.properties file, which is in
>WEB_INF/classes:
>
>---------------
>
># Set root category priority to DEBUG and its only appender to A1.
>log4j.rootCategory=DEBUG, A1
>
># A1 is set to be a RollingFileAppender.
>log4j.appender.A1=org.apache.log4j.RollingFileAppender
>
>log4j.appender.A1.File=info.log
>log4j.appender.A1.MaxFileSize=100KB
>
># Keep one backup file
>log4j.appender.A1.MaxBackupIndex=2
>
># A1 uses PatternLayout.
>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>log4j.appender.A1.layout.ConversionPattern=%5p %d (%F:%L) - %m%n

Looks good.

>---------------
>
>I have the following as the first entry in my web.xml:
>
>---------------
>
>     <servlet>
>         <servlet-name>log4j-init</servlet-name>
>         <servlet-class>trajectoryview.util.Log4jInit</servlet-class>
>         <init-param>
>             <param-name>log4j-init-file</param-name>
>             <param-value>WEB-INF/classes/log4j.properties</param-value>
>         </init-param>
>         <load-on-startup>1</load-on-startup>
>     </servlet>

Looks good.

>---------------
>
>My servlet which does the initialization has the following init()
>method:
>
>---------------
>
>public void init()
>     {
>         // gets the base directory to use, from the web application's
>"context"
>         String prefix = getServletContext().getRealPath("/");
>
>         // this looks in the web.xml for the initialization file
>parameter
>         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
>file
>             PropertyConfigurator.configure(prefix + file);
>         }
>     }
>
>---------------

Looks good too.


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

The fact that log4j should not initialize at all in your dev machine is
very strange indeed. I don't know how to help you.

--
Celo



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

Reply via email to