Websphere all logs are going to SystemOut.log
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.
Logging Stopped in Websphere
You might want to cross check the configuration in WAS admin console whether if it is mapped to the proper location as expected. Because the scenario of yours works fine with my environment.
Console -> Troubleshooting->Logs and Trace
Websphere with Logback logging to system out - formatting issue
I don't think you're going to be able to change the format. And if you could, it might break the current monitoring anyway.
I wonder if anyone would mind if you log to two loggers at the same time, SystemOut for the existing monitoring, and your own for a more readable format.
WebSphere logging to customized files
You have several options, which more or less can help you in archiving desired result.
1) WebSphere is using JUL and Jakarta Commons internally, so you can customize it but its a bit complex. See Adding logging and tracing to your application
2) Use external logger like log4j - see some more basic info here - WAS Logging - Java Util Logging and Log4j
3) Use new HPEL logging available since WAS 8.0. Although it doesn't create logs for each application, you can any time query log messages for the given application using logViewer, like this (you can also use tail like behavior using -monitor
flag):
logViewer -includeExtensions appName=PlantsByWebSphere
It also allows you to do some more nice things like for example display only messages from given thread, etc. And is fully integrated in the admin console.
I'd recommend at least trying it, maybe it will fulfill your needs.
Some more details here:
- High Performance Extensible Logging (HPEL)
- LogViewer command-line tool usage and options
- Log viewer in the console
Related Topics
Why Can Array Constants Only Be Used in Initializers
Can't Make Jackson and Lombok Work Together
Jackson: How to Add Custom Property to the JSON Without Modifying the Pojo
How to Identify Contents of a Byte[] Is a Jpeg
How to Rotate Jpeg Images Based on the Orientation Metadata
Formatting a String to a Currency Format in Jasper Report
Java: String Concat VS Stringbuilder - Optimised, So What Should I Do
How to Execute .SQL Script File Using Jdbc
Calling Static Method from Another Java Class
Service Layer and Controller: Who Takes Care of What
Multiple Axes on the Same Data
The Easiest Way to Transform Collection to Array
How to Set Up Default Schema Name in JPA Configuration
Rounding Up a Number to Nearest Multiple of 5
How to Redirect to Another Action Class Without Using on Struts.Xml