Controlling stderr and stdout output in WildFly

2019-05-03 23:53发布

In my application I got used to the following debug output: normally it prints a few lines per request to stderr, but logs a lot of information (via log4j) to a file. Typically, most important thing for me is the stderr output (that's why I want it concise), but when something doesn't work as expected, I can investigate the log, which can easily be thousands line per request.

Now that I'm migrating the application to WildFly, I found that the server pipes all stderr output through its logging system, so it looks like this:

14:06:15,464 ERROR [stderr] (default task-13) ACTUAL-DEBUG-OUTPUT

and is additionally colored as an error. Also, stdout output seems to be redirected to /dev/null...

Can I somehow configure WildFly to just let stderr output go through as is, without adding useless (for me) noise and coloring? If possible, I'd like to do the same for stdout.

1条回答
smile是对你的礼貌
2楼-- · 2019-05-04 00:57

OK, with some googling and hacking I got what I want:

/subsystem=logging/console-handler=JUST-PRINT:add(formatter="%s%E%n")
/subsystem=logging/logger=stderr:add(use-parent-handlers="false", handlers=[JUST-PRINT])
/subsystem=logging/logger=stdout:add(use-parent-handlers="false", handlers=[JUST-PRINT])
查看更多
登录 后发表回答