log4j configuration in Weblogic


General J2EE: log4j configuration in Weblogic

  1. log4j configuration in Weblogic (4 messages)

    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.

    Threaded Messages (4)

  2. log4j configuration in Weblogic[ Go to top ]


    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...


  3. my settings[ Go to top ]

    Hi Rene,
    thanks for your interest. My log4j properties file looks like:

    log4j.rootCategory=DEBUG, C

    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?
  4. my settings[ Go to top ]

    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.

    set CLASSPATH=.;./lib/weblogic.jar;./ext/log4j.jar

    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.

  5. my settings[ Go to top ]

    Whoops! That is, place the log4j.jar file in the bea/wlserver6.1/ext directory.