Re: org/apache/log4j/Category problem
On Thu, 2003-08-28 at 03:43, Rishikesh Tembe wrote: > Hi > > Thanks Phil and Jacob for your input. > > The problem was due to the existence of multiple versions of the jog4j.jar > file. After I cleaned everything up, put the jar in WEB-INF/lib and the > props file in WEB-INF/classes, everything worked! > > Has the format of the XML/props file been specfied anywhere? I couldn't > find a list of supported properties in the manual... Hi again, All the supported properties for Appenders etc are the public setter methods. e.g. if an Appender has a setFile(..) method, then there is a 'file' property that can be set, so it's usually just a matter of looking at the JavaDoc for the specific item in question. For the other configuration elements I would recommend reading these links: * The Log4J FAQ Wiki - http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/FrequentlyAskedQuestions (The first link is on XML Configuration) * The Property Config Javadoc - http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurator.html ( the first link in the desc, doConfigure(...) contains the juicy bits. Don't forget Ceki's book, https://www.qos.ch/shop/products/clm_t.jsp you'll be kicking goals in no time with this. Paul Smith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: org/apache/log4j/Category problem
Hi Thanks Phil and Jacob for your input. The problem was due to the existence of multiple versions of the jog4j.jar file. After I cleaned everything up, put the jar in WEB-INF/lib and the props file in WEB-INF/classes, everything worked! Has the format of the XML/props file been specfied anywhere? I couldn't find a list of supported properties in the manual... -Rishi. = Yahoo! India Promos: Win TVs, Bikes, DVD players & more! Go to http://in.promos.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: org/apache/log4j/Category problem
Hi Rishi, Notice that you didn't get a ClassNotFoundException, but a NoClassDefFoundError. They are very different. The former means that it couldn't be found on the classpath where the latter means that at least one was found, but not the version it expected. This is usually caused by different versions of the class viewable by the classloader. Double check that you dont' have an old version of log4j.jar in JAVA_HOME/jre/lib/ext or something like that. Also, how are you starting Tomcat? Is it via the scripts or via an installed service? The scripts eschew the system classpath altogether, but if you run as a service, you are at the mercy of whatever junk is on your system classpath (if you provided it to the service installer). Of course, jre/lib/ext or jre/lib/endorsed are viewed as part of the JDK so watch what you put there. It will almost always mess things up. The easiest way to avoid collisions with various versions of log4j.jar running around is to put the jar in the WEB-INF/lib directory of your webapp. And, as Paul mentioned in his reply, put log4j.xml or log4j.properties in WEB-INF/classes to allow log4j to use default initialization without you having to intervene with an init servlet. Let us know how things go after you do that. Jake At 02:48 AM 8/27/2003 +0100, you wrote: Hi all, I have a servlet running in Tomcat, which I have setup to do logging via log4j. However, I get the foll. error when I try to run my app: java.lang.NoClassDefFoundError: org/apache/log4j/Category I have the jog4j-1.2.8.jar file in my classpath. I have also done: PropertyConfigurator.configure("http://localhost:8080/examples/log4j.properties";); where log4j.properties looks like: log4j.rootLogger=INFO, d1 log4j.appender.d1=org.apache.log4j.FileAppender log4j.appender.d1.layout=org.apache.log4j.SimpleLayout Can anyone give me hints as to what's wrong? thanks! Rishi Yahoo! India Promos: Win TVs, Bikes, DVD players & more! Go to http://in.promos.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: org/apache/log4j/Category problem
On Wed, 2003-08-27 at 11:48, Rishikesh Tembe wrote: > Hi all, > > I have a servlet running in Tomcat, which I have setup to do logging via > log4j. However, I get the foll. error when I try to run my app: > > java.lang.NoClassDefFoundError: org/apache/log4j/Category > > I have the jog4j-1.2.8.jar file in my classpath. Yes, it might be in your classpath, but is Tomcat using that classpath? NoClassDefFoundError definately means the CLassloader cannot locate the class via any means. Try dropping the log4j Jar file in your webapps WEB-INF/lib directory. You can also save yourself the effort of property configuration code by putting the log4j.properties file physically in the WEB-INF/classes directory of your webapp, Log4j will then find it auto-magically. cheers, Paul Smith - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]