Files
Mahmoud Ben Hassine e3cb93791d Update documentation
2025-04-25 10:13:56 +02:00

48 lines
1.1 KiB
Plaintext

[[using-shell-customization-logging]]
= Logging
By default, a _Spring Boot_ application logs 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 Spring Boot properties.
To completely silence console logging, set the console's logging pattern to 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 configuration properties as command line options is not supported,
but you can use other ways supported by Spring 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.