tags:

views:

739

answers:

2

Hi,

In my web application I am inititalizing logging in my web application by using the PropertyConfigurator.configure(filepath) function in a servlet which is loaded on startup.

String log4jfile = getInitParameter("log4j-init-file"); if (log4jfile != null) { String propfile = getServletContext().getRealPath(log4jfile); PropertyConfigurator.configure(propfile);

I have placed my log4j.properties file in WEB_INF/classes directory and am specifying the file as

log4j.appender.rollingFile.File=${catalina.home}/logs/myapp.log

My root logger was initally configured as : log4j.rootLogger=DEBUG, rollingFile,console (I believe the console attribute also logs the statements into catalina.out)

In windows the logging seems to occor normally with the statements appearing in the log file.

In unix my logging statements are being redirected to the catalina.out instead of my actual log file(Which contains only logs from the initalization servlet).All subsequent logs show up in catalina.out.

This leads me to believe that my log4j is not getting set properly but I am unable to figure out the cause.Could anyone help me figure out where the problem might be.

Thanks in advance, Fell

A: 

It will depend on the server you are using. Is it Tomcat? Is it the same version on Windows and on Linux?

oscargm
A: 

It may be a permissions problem - check the owners and permissions of the ${catalina.home}/logs directory.

Nate