Question

I have a problem with logback + wildfly 8 configuration. I'm using simple ConsoleAppender:

appender("STDOUT", ConsoleAppender) {
    encoder(PatternLayoutEncoder) {
        pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{70} - %msg%n"
    }
}
logger("com.package.app", INFO)
root(DEBUG, ["STDOUT"])

The problem is that Wildfly appends to logback messages also server's log pattern. It looks like:

11:31:49,954 INFO  [stdout] (default task-1) 11:31:49.951 [default task-1] INFO  com.package.app.controller.FrontController - message...

As You can see, there is a server logs pattern first and then the logback message

How to solve this problem?

Was it helpful?

Solution

WildFly captures System.out and System.err and redirects them to a logger. You could configure a logger in WildFly with the name stdout, set the use-parent-handlers attribute to false and set the level to NONE. This should disable System.out from printing which means it will also not appear in the server.log.

That said, I don't see a reason to use logback for a ConsoleAppender since the server already provides one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top