Websphere all logs go to SystemOut.log

I use Log4j in my application and have some applications for debugging and errors. I tested this on tomcat and worked fine. Creation of all logs in the corresponding files. But when I deploy the code to WAS6.1, all the logs are generated only inside SystemOut.log.

Please, help!

+6
source share
1 answer

The problem may be that WebSphere 6.1 uses Jakarta Commons Logging (JCL) internally, and if any of your code or third-party libraries also use JCL, WebSphere configuration conflicts with your application try to use log4j. If this happens, you will see what exactly you see.

There are several links and blog posts that describe how to solve this problem. We found that the easiest way to create a file called org.apache.commons.logging.LogFactory in the META-INF/services your web application (in the WAR root archive). This file should contain the line:

 org.apache.commons.logging.impl.Log4jFactory 

(At least with the new versions of WebSphere ...) Another key is that the JCL bank needs to be loaded from the same location as the log4j log file. for example, either from WEB-INF / lib, or from a shared library. Therefore, you cannot refuse to download the JCL from your copy of WebSphere. If they are loaded by different class loaders , they cannot correctly see each other.

+8
source

Source: https://habr.com/ru/post/901481/


All Articles