1

I have a Java application running on WAS 6.1, with Log4j used for logging. Log files are not created. Some other configuration for logging is used, but not the one that is packaged with the application.

Where should I check for WAS6.1 global log4j configuration? How can I overwrite it for a particular application?

The application is deployed from the war archive.
log4j-1.2.14.jar is packaged with the application in the WEB-INF/lib directory. I have put a commons-logging.properties file in WEB-INF directory.

Here's my web.xml:

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    id="WebApp_ID" version="2.4">
    <display-name>LineCheckOptimizerWeb</display-name>
    <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/log4j.xml</param-value>
</context-param>

<listener>
    <description>Initializes a Guice Injector and installs it into the ServletContext</description>
    <display-name>GuiceInitializer</display-name>
    <listener-class>com.aa.otrs.lco.guice.GuiceInitializer</listener-class>
</listener>

    <servlet>
            <servlet-name>MessageBrokerServlet</servlet-name>
            <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
            <init-param>
                    <param-name>services.configuration.file</param-name>
                    <param-value>/WEB-INF/flex/services-config.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
            <servlet-name>MessageBrokerServlet</servlet-name>
            <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>

    <resource-ref>
            <description>LCO JDBC Datasource</description>
            <res-ref-name>jdbc/lco</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
    </resource-ref>

jprusakova
  • 1,557
  • 3
  • 19
  • 31
  • This sounds like the same issue in http://stackoverflow.com/questions/8131529/websphere-all-logs-are-going-to-systemout-log/8138477 See if the answer there helps you. – dbreaux Aug 14 '12 at 18:05
  • thanks for the pointer, but no - doesn't seem to make any difference. – jprusakova Aug 14 '12 at 18:26
  • WAS doesn't use log4j, but it does use JCL. So it won't pick up your commons-logging.properties. Which thing did you try that didn't make a difference? – dbreaux Aug 14 '12 at 18:29
  • I added org.apache.commons.logging.LogFactory to META-INF/services directory, as suggested in http://stackoverflow.com/questions/8131529/websphere-all-logs-are-going-to-systemout-log/8138477 – jprusakova Aug 14 '12 at 18:36
  • I knew I didn't recognize ``. I have no idea if that is related to your problem, but I'm pretty sure only the Geronimo-based version of WebSphere, WebSphere Community Edition, understands that. Not WebSphere 6.1. – dbreaux Aug 14 '12 at 20:50
  • that makes sense. Taking it out. – jprusakova Aug 14 '12 at 21:05

3 Answers3

2

Check if any other jar file is present in your application which also includes a log4j.xml. Conflict will not allow proper logging to be enabled. Also enable trace with trace string com.ibm.ws.classloader.*=all and restart the server. Check trace.log

I faced similar issue recently where the team added external jars

ad-inf
  • 1,520
  • 4
  • 30
  • 53
0

I would turn on the debugger for log4j (via the System D property) and see what is the log4j properties that is picked and if it picks up the one that you expect it to. This is the first thing to do when you encounter log4j config issues.

If you are using JCL , WAS 6.1 has moved away from JCL and uses JUL (saying this from memory) Have a look at this -> http://www.ibm.com/developerworks/websphere/techjournal/0901_supauth/0901_supauth.html and see if that helps.

Manglu
  • 10,744
  • 12
  • 44
  • 57
0

Turns out it was missing a log4j jar inside one of the project *.jar-s that had the logging inside it. Fixed it, and viola - it worked, log files magically appeared as expected.

jprusakova
  • 1,557
  • 3
  • 19
  • 31