Hi, I am running tomcat 4.0.1 on Solaris with two web applications. I recently added log4j code to my applications, and after reading log4j's Short Manual, decided to set up my configuration to use an initialization servlet to initialize log4j, since that's the most flexible way to do it. I put the log4j.jar file in the WEB-INF/lib directory of each web application. During tomcat's startup process (started with -Dlog4j.debug), the log4j.properties file for the first application is parsed successfully, but the log4j.properties file for the second application generates warning and error messages saying it failed to set a property because the "object is not an instance of declaring class". More details follow.
I first wrote the initialization servlet to set the system property log4j.configuration to the full path of my log4j.properties file, since that's the preferred way to specify the default initialization file, according to the Short Manual. The log4j.properties file for each web application used the same appender name (logFile), but the File property of this appender (a DailyRollingFileAppender) was different for each web application. Since tomcat's Class Loader HOW-TO says that each application gets its own class loader, I didn't think that using the same appender name for each application would cause any problems. However, this configuration generated the errors mentioned above. In my search for a solution to this problem, I found the JGuru web page at http://www.jguru.com/forums/view.jsp?EID=801715. Based on the postings on this page, I modified the log4j.properties file for each web application to use different appender names, instead of the same name. I also modified my initializing servlet to call the PropertyConfigurator.configure method directly instead of relying on the automatic configuration from the log4j.configuration system property (see the last reply on that page). Unfortunately, this configuration generated the same warnings and errors. I have searched the user groups and FAQs quite extensively in the last couple of days, and tried everything I could think of (based on what I read), but I still have not been able to successfully configure log4j for multiple tomcat web applications (only two, in this case). I have attached the log4j.properties files for each of my two applications (they have been renamed so the names would be unique), the source code for the initializing servlet, a snippet of the web.xml file (same for both applications), and a snippet of the catalina.out log file listing the warning and error messages. Maybe someone can spot a configuration error or some missing information. Any clue on how to solve this problem, or a pointer to what I should try next or where else to look for an answer would be greatly appreciated. Thanks, Pat Patricia T. Guimaraes Software Engineer Gene Logic, Inc. (See attached file: portal_log4j.properties) (See attached file: analysis_log4j.properties) (See attached file: Log4jInit.java) (See attached file: web.xml) (See attached file: catalina.out)
portal_log4j.properties
Description: Binary data
analysis_log4j.properties
Description: Binary data
Log4jInit.java
Description: Binary data
web.xml
Description: Binary data
catalina.out
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
