I am not able to get the log4j.properties file properly initialized using the log4j example JSP pages. I've tried it in both Tomcat (3.2) and JRun (3.1) with the same results. I read the documentation and followed the suggestion of leaving the log4j.properties file in the WEB-INF\classes file. Briefly here are the steps I followed to get the error: 1. unzipped the contents of "log-examples.war" into "\tomcat\webapps\log4j". 2. verified the WEB-INF\web.xml file contained the references to the log.tld. 3. verified the log4j jar files were in the WEB-INF\lib directory. 4. created a log4j webapp in Tomcat's server.xml. 5. opened url http://localhost/log4j/index.html. 6. clicked on the "test1" link and the test1.jsp displayed "Test debug; you should see output in the debug logs now". I was expecting to find log messages in the Tomcat stdout file, based on the log4j.properties file (left it asis; no changes were made to it from the distribution). BELOW ARE LAST LINES OF TOMCAT STDOUT FILE WITH LOG4J ERRORS: 2001-08-14 09:28:17 - ContextManager: Adding context Ctx( /log4j ) 2001-08-14 09:28:17 - ContextManager: Adding context Ctx( /servlet ) 2001-08-14 09:28:17 - ContextManager: Adding context Ctx( /admin ) 2001-08-14 09:28:17 - ContextManager: Adding context Ctx( ) 2001-08-14 09:28:19 - PoolTcpConnector: Starting HttpConnectionHandler on 80 2001-08-14 09:28:19 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007 log4j:ERROR No appenders could be found for category (root). log4j:ERROR Please initialize the log4j system properly. BELOW IS OUTPUT OF JASPER LOGFILE SHOWING CLASSPATH INFO: 2001-08-14 09:28:18 - IMPORTANT: Do not modify the generated servlets 2001-08-14 09:28:45 - JspEngine --> /test1.jsp 2001-08-14 09:28:45 - ServletPath: /test1.jsp 2001-08-14 09:28:45 - PathInfo: null 2001-08-14 09:28:45 - RealPath: D:\tomcat\webapps\log4j\test1.jsp 2001-08-14 09:28:45 - RequestURI: /log4j/test1.jsp 2001-08-14 09:28:45 - QueryString: null 2001-08-14 09:28:45 - Request Params: 2001-08-14 09:28:45 - Classpath according to the Servlet Engine is: D:\tomcat\webapps\log4j\WEB-INF\classes;D:\tomcat\webapps\log4j\WEB- INF\lib\log.jar;D:\tomcat\webapps\log4j\WEB-INF\lib\log4j-core.jar
Created attachment 421 [details] my log4j.properties file
Wrong buglist. You probably want to try on the taglibs project.
Sorry, but according to the Taglib team this is the place to enter Taglib bugs...Isn't that what "Product" above means ?
I am reassigning bug to the owner of Taglibs. Regards, Ceki
any idea as to when the Taglib team will be looking into my problem?
AFAIK log4j should find the logj4.properties file in WEB-INF/classes. Maybe the JSP / taglib code doesn't have access to the WEB-INF/classes ClassLoader on Tomcat 3.2 / JRun 3.1. I've tried this with Tomcat 4.0 beta 6 and it appears to work fine. Maybe a workaround on Tomcat 3.2 and JRun 3.1 is to explicitly add a directory to your system CLASSPATH and put log4j.properties in that directory, so that log4j.properties can be found properly. Or an alternative could be to write a Servlet to initialize log4j on startup. The problem appears to be that taglib code using log4j doesn't seem to be able to see the log4j.properties file on the CLASSPATH - which sounds like a container problem. There is nothing the taglib can do to change how log4j looks for its log4j.properties file, nor can it work around class loader wierdness in containers - so I'm afraid a work around is required to initialise log4j. Maybe log4j could come with a standard Servlet that could be used to initialise log4j in circumstances such as these.