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?
WildFly captures
System.out
andSystem.err
and redirects them to a logger. You could configure a logger in WildFly with the namestdout
, set theuse-parent-handlers
attribute tofalse
and set the level toNONE
. This should disableSystem.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.