Files
spring-shell/spring-shell-docs/modules/ROOT/pages/using-shell-customization-logging.adoc
2023-08-03 14:58:09 -05:00

56 lines
1.1 KiB
Plaintext

[[using-shell-customization-logging]]
= 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.
====
[source, yaml]
----
logging:
pattern:
console:
----
====
If you need log from a shell then write those into a file.
====
[source, yaml]
----
logging:
file:
name: shell.log
----
====
If you need different log levels.
====
[source, yaml]
----
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.
====
[source, bash]
----
$ java -Dlogging.level.root=debug -jar demo.jar
$ LOGGING_LEVEL_ROOT=debug java -jar demo.jar
----
====
NOTE: In a GraalVM image settings are locked during compilation which means
you can't change log levels at runtime.