JES5 and log4j inconsistencies from 2005Q4 with multiple web applications

We recently upgraded from JES 2005Q4 to JES5, and did a fresh installation of Solaris 9 & JES5. All our servlets and portlets in the portal server seem to work ok with the exception of our log4j logging mechanism.

We have 4 customized portlets and 5 servlets, and are using the same instance on the Application Server as the host for our access manager, portal server, and custom servlets & portlets.

On 2005Q4, we had each of our portlets and servlets logging to separate log files using log4j (v1.2.8), by placing the log4j jar file in each web app's WEB-INF/lib path, with the log4j.properties file in each web app's WEB-INF/classes path, and it was working fine logging to separate log files for each web application.

But when I deploy the same servlets and portlets to JES5, whichever application happens to have written a log entry first appears to create/log to it's respective log file. Unfortunately, all our other servlets and portlets also then using the same log file, apparently using the same properties file as the first one that logged, even though the settings for each call out separate log files.

I've googled extensively to see if we're doing something wrong, but am fairly certain we are doing everything correctly since we have placed the log4j jar file in each web app's warfile. Does anyone know what's different between 2005Q4 & JES5 that may be causing this? Is this a class loader issue? I've checked the App Server JVM classpath and it does not include log4j's jar file. The portal server and psconsole apps have it defined in their respective WEB-INF/lib paths, but that shouldn't (and isn't) interfering with our apps' use of log4j.

Any help is greatly appreciated. Thanks in advance!

[1775 byte] By [JJ_a] at [2007-11-27 4:06:53]
# 1

To resolve this, I had to create a sun-web.xml file in each web app's WEB-INF/ path in the warfile that contains the following information:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-1.dtd">

<sun-web-app>

<context-root>/(deployed servlet URI path)</context-root>

<class-loader delegate="false"/>

</sun-web-app>

The key is the class-loader designation. The rest of the file is autogenerated when you deploy a web app to the application server instance path "generated/xml/j2ee-modules/<deployed servlet name>/sun-web.xml.

I copied that file, which does NOT contain a class-loader designation (the default value is "true") to my servlet's WEB-INF path and updated it to include the false delegate value for the class loader, and that appears to have resolved my problem.

What is puzzling is why this wasn't necessary in the older version, but is necessary to get multiple logging to work in JES5.

JJ_a at 2007-7-12 9:12:03 > top of Java-index,Java Enterprise System,Java Enterprise System - General Discussion...
# 2

I'm trying to solve a little different issue. I'd like to enable log4j logging to different files from

-an EJB app

-WebServices using the above EJB

-a web (war) app, using the above webservices.

Can you please help me setting up log4j to enable all my application components to log to different files?

I only suceeded with my war component putting log4j.jar and log4j.properties in its WEB-INF folder, but with the others, I couldn't solve the problem. Could you please help?

sine_morboa at 2007-7-12 9:12:03 > top of Java-index,Java Enterprise System,Java Enterprise System - General Discussion...