dockerloggingthorntail

Configure Thorntail logging to System.out


In a Thorntail project, the logging configuration for CONSOLE works as expected:

thorntail:
  logging:
    pattern-formatters:
      LOG_FORMATTER:
        pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS} %p [%c] (%t) %s%e%n"
    console-handlers:
      CONSOLE:
        named-formatter: LOG_FORMATTER
        target: console
    root-logger:
      handlers:
      - CONSOLE

In a Docker environment I need to output the logs using System.out. According to the documentation, the target key has three possible values:

thorntail.logging.console-handlers.KEY.target

Defines the target of the console handler. The value can be System.out, System.err or console.

I did change my target to System.out as follows:

thorntail:
  logging:
    pattern-formatters:
      LOG_FORMATTER:
        pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS} %p [%c] (%t) %s%e%n"
    console-handlers:
      CONSOLE:
        named-formatter: LOG_FORMATTER
        target: System.out
    root-logger:
      handlers:
      - CONSOLE

And then I get this exception where one of the possible values is the one I configured...

java.lang.IllegalArgumentException: Invalid value 'System.out'; should be one of: console,System.out,System.err

What am I doing wrong?


Solution

  • I'm not sure where's the problem, but System.out is the default value per https://github.com/wildfly/wildfly-core/blob/7.0.0.Final/logging/src/main/java/org/jboss/as/logging/handlers/ConsoleHandlerResourceDefinition.java#L51, so you can just leave the target out completely.