"Robert Taylor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Greetings, I'm trying to use Log4j in my web app and I'm having some > difficulty. > > I'm running Tomcat5.5.7 and JDK 1.5.0 > I've followed the instructions here: > http://jakarta.apache.org/tomcat/tomcat-5.5-doc/logging.html > -placed log4j.jar and commons-logging.jar in commons/lib > -placed log4j.xml in commons/classes > -Added the following to the Tomcat startup: > -Dlog4j.configuration=file:///D:/j2ee_containers/servlet/tomcat/5.5.7/Tomcat%205.5/common/classes/log4j.xml >
Don't know exactly what you're trying to do. The URL above is about using log4j for Tomcat internal logging (including HttpServlet.log). If you don't care about this, then just remove the log4j.jar from commons/lib (and log4j.xml from commons/classes just to be clean :). Then you're webapp will use the log4j in WEB-INF/lib and everybody is happy. Alternatively, if you want to use log4j for Tomcat logging as well as for your webapp, then either: 1) remove the log4j.jar from your webapp's WEB-INF/lib and force it to use the one in common/lib. This is good for small sites that want one central place to control all of the logging, and can easily setup common/classes/log4j.xml to handle all webapps that are deployed. 2) move log4j.jar to $CATALINA_HOME/server/lib and log4j.xml to $CATALINA_HOME/server/classes. In this case, this copy of log4j will be used for Tomcat internal logging only. Your webapp will use the copy in WEB-INF/lib, with the configuration that is in WEB-INF/classes. Personally, if you're not a Tomcat developer, I think that this is a questionable use-case since Juli (the default Tomcat logging) is good enough to handle the Tomcat logs in most cases. > It looks like Tomcat is finding and recognizing log4j.xml but is failing > with the following error in the log file: > > log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not > assignable to a "org.apache.log4j.spi.Configurator" variable. > log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by > log4j:ERROR [EMAIL PROTECTED] > whereas object of type > log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by > [WebappClassLoader > delegate: false > repositories: > ----------> Parent Classloader: > [EMAIL PROTECTED] > ]. > log4j:ERROR Could not instantiate configurator > [org.apache.log4j.xml.DOMConfigurator]. > > > I googled for this and didn't find anything relavent. > http://www.google.com/search?biw=1266&hl=en&q=A+%22org.apache.log4j.xml.DOMConfigurator%22+object+is+not+assignable+to+a+%22org.apache.log4j.spi.Configurator%22+variable.&btnG=Google+Search > > > Any hints (even if its RTFM with a link) would be great. > > /robert --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
