Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Websphere all logs are going to SystemOut.log

I am using Log4j in my application and have some appenders for debug and error. I tested this on tomcat and working fine. Generating all logs in their respective files. But when I deploy code on WAS6.1 all logs are getting generated only inside SystemOut.log.

Please help!

like image 784
Dev G Avatar asked Nov 15 '11 04:11

Dev G


People also ask

What is SystemOut log in WebSphere?

The WebSphere® Application Server log files contain information that you can use to monitor WebSphere Application Server startup and diagnose errors. The following log files are useful for diagnosing problems with IBM® InfoSphere® Information Server: SystemOut. log.

Where are WebSphere logs stored?

WebSphere application log files can be found in the logs folder for each profile in the cell; for example, $WAS_HOME/profiles/<profile_name>/logs. There is a folder for each server in the logs directory. This is generally where the JVM stdout and stderr logs (SystemOut. logand SystemErr.

What is the difference between SystemOut log and SystemErr log?

out sends the output to the standard output stream. System. err sends the output to the standard error stream. By default both of these write to the console.


1 Answers

The problem might be that WebSphere 6.1 uses Jakarta Commons Logging (JCL) internally, and if any of your code or 3rd-party libraries also use JCL, WebSphere's configuration conflicts with your application trying to use log4j. If this is happening, you'll see exactly what you're seeing.

There are multiple references and blog posts that describe ways to address this. We've found the simplest to be creating a file named org.apache.commons.logging.LogFactory in the META-INF/services directory of your web application (in the root of the WAR archive). This file must contain the line:

org.apache.commons.logging.impl.Log4jFactory

(At least with newer versions of WebSphere...) Another key is that the JCL jar must be loaded from the same location as the log4j jar. e.g. either both from WEB-INF/lib or both from a shared library. Thus, you can't fall back on loading JCL from WebSphere's own provided copy. If they're loaded by different classloaders, they can't properly see each other.

like image 123
dbreaux Avatar answered Sep 16 '22 19:09

dbreaux