I'm trying to use log4j with my application deployed on weblogic6.1. Even though I'm doing the configuration settings in my server startup file, I keep getting the following error message on the server console:
log4j:ERROR No appenders could be found for category...
log4j:ERROR Please initialize the log4j system properly.
I have placed log4j.properties file in WEB-INF directory and my startup file reads it from this location.
Can anybody provide with me with pointers indicating what is going wrong in my setup?
Thanks in advance.
P.S: My application uses EJBs and servlets.
it would help if you post your log4j.properties to check if the syntax is correct...
Besides - usually properties files should be located inside a JAR (in WEB-INF/lib) or directly in WEB-INF/classes, but not in the WEB-INF root directory. The JSP engine resp. log4j won't find it there...
thanks for your interest. My log4j properties file looks like:
As you can see, there is no problem with the syntax. After some detailed analysis of my setup, it looks to me that the message driven beans packaged inside one of my jar files in WEB-INF/lib directory are trying to access the logger API (at deployment time) before my actual server side startup file gets a chance for execution and hence the error.
How should I go about configuring the log4j in this case?
Place the log4j.properties file in your bea/wlserver6.1/ directory. Place the log4j.jar file in the bea/wlserver6.1/ directory. In the "startWeblogic.cmd" batch file, located at bea/wlserver6.1/config/<server name> where the CLASSPATH variable is set, make sure to put a single dot at the beginning, followed by a semi-colon, i.e.
This tells the Weblogic classloader to look in the "." directory for resources first, so when log4j looks for the properties file, it can find it.
Whoops! That is, place the log4j.jar file in the bea/wlserver6.1/ext directory.