Skip to content

Commit

Permalink
Add ability to log to stderr
Browse files Browse the repository at this point in the history
Fixes quarkusio#9569

(cherry picked from commit e095c1c)
  • Loading branch information
stuartwdouglas authored and gsmet committed Jun 10, 2021
1 parent d0e79ae commit 839ba9f
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -15,6 +15,12 @@ public class ConsoleConfig {
@ConfigItem(defaultValue = "true")
boolean enable;

/**
* If console logging should go to {@link System#err} instead of {@link System#out}.
*/
@ConfigItem(defaultValue = "false")
boolean stderr;

/**
* The log format. Note that this value will be ignored if an extension is present that takes
* control of console formatting (e.g. an XML or JSON-format extension).
Original file line number Diff line number Diff line change
@@ -343,7 +343,8 @@ private static Handler configureConsoleHandler(final ConsoleConfig config, final
}
}
}
final ConsoleHandler consoleHandler = new ConsoleHandler(ConsoleHandler.Target.SYSTEM_OUT, formatter);
final ConsoleHandler consoleHandler = new ConsoleHandler(
config.stderr ? ConsoleHandler.Target.SYSTEM_ERR : ConsoleHandler.Target.SYSTEM_OUT, formatter);
consoleHandler.setLevel(config.level);
consoleHandler.setErrorManager(defaultErrorManager);
consoleHandler.setFilter(new LogCleanupFilter(filterElements));

0 comments on commit 839ba9f

Please sign in to comment.