Logging

On default a Spring Boot application will log messages into a console which at minimum is annoying and may also mix output from a shell commands. Fortunately there is a simple way to instruct logging changes via boot properties.

Completely silence console logging by defining its pattern as an empty value.

logging:
  pattern:
    console:

If you need log from a shell then write those into a file.

logging:
  file:
    name: shell.log

If you need different log levels.

logging:
  level:
    org:
      springframework:
        shell: debug

Passing contiguration properties as command line options is not supported but you can use any other ways supported by boot, for example.

$ java -Dlogging.level.root=debug -jar demo.jar
$ LOGGING_LEVEL_ROOT=debug java -jar demo.jar
In a GraalVM image settings are locked during compilation which means you can’t change log levels at runtime.