-
1. Re: ConsoleHandler: Redirect to STDERR
jamezp Dec 16, 2013 7:15 PM (in response to bechtleag)By default the console-handler writes to "System.out" (stdout). The console-handler will not write to multiple streams. You can define an additional console-handler with a level of ERROR to write to "System.err" though. Then change the level on the default CONSOLE to WARN and add the new stderr handler to the root-logger.
The CLI do do this would be something like.
/subsystem=logging/console-handler=stderr:add(autoflush=true,level=ERROR,formatter="%K{level}%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n", target=System.err) /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=WARN) /subsystem=logging/root-logger=ROOT:add-handler(name=stderr)
Note depending on the version of JBoss AS/EAP/WildFly you're using the last operation might need to be root-logger-assign-handler(name=stderr).
--
James R. Perkins
-
2. Re: ConsoleHandler: Redirect to STDERR
wdfink Dec 17, 2013 2:38 AM (in response to bechtleag)Additional to James Perkins I would avoid such redirecting in production as you might have several drawbacks in performance and handling.
If you need a separate file with the ERROR/WARN messages I would add a file appender with the jboss.err file and restrict the level to that.