Search code examples
javajakarta-eeloggingwebspherelogback

Websphere with Logback logging to system out - formatting issue


I am using Logback in my application hosted on Websphere App Server. Logback is configured to log to System Out (and others are hesitant to change to a different file). The issue is that Websphere uses its own format for logging to System Out. Executing logger.debug("test") in my app yields:

[8/7/12 12:27:55:629 CDT] 0000003a SystemOut     O DEBUG com.myapp... test

where everything up to the "O" is added by Websphere. The rest is from Logback

I have set up Logback to use the following pattern: %-5level %logger{36} - %msg%n so that I don't repeat timestamp and thread info which Websphere does on its own, but I am still annoyed that I can't fully customize the logging to System Out from within Logback.

I don't know a whole lot about logging best practices. Before, I have logged to separate files by web app, but for this project, I was told the System Out files are monitored by a third party and I should not change from using System Out. Is there any way to get around my issue given these requirements and tell Websphere not to mess with my System Out logging, or is the only solution to start logging to a different file? Thanks!


Solution

  • 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.