I'm looking to upgrade our tomcat instance from 5.5.27 to 6.0.32 and am having some issues with the logging from jars in the shared/lib directory (I've recreated this directory in tomcat 6).
We have a jar file that we create as part of our build process with some common code in it and under tomcat 5 this lived under shared/lib. When we wrote log statements from code in this jar file, they were written to the log file of the web application calling the jar at that moment. Each of our webapps has a log4j.properites and log4j.jar in it's WEB-INF/lib directory, and there was also a log4j.jar in shared/lib, but not log4j/properties.
We're using log4j and obtain references to logs as follows:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MyClass {
private final static Log CLASS_LOG = LogFactory.getLog(MyClass.class);
}
But when I move the exact same configuration of our jars, webapps, log4.properties and log4j.jars into tomcat 6, the logging statements from our common jar just go to catalina.log.
I've done a fair amount of reading (including http://www.mulesoft.com/tomcat-classpath, and the classloader and logging docs on the tomcat website) and mostly I can't work out how it worked the way it did in tomcat 5! (I didn't set it up, it's something I've inherited that until now has 'just worked').
Does anyone have any similar experience of trying to get logs from shared libs into webapp log files? I'm thinking that putting the shared jar in each webapp's WEB-INF/lib directory would sort this but then I'd end up with many copies of the same thing.