Add support for LOG_LEVEL_PATTERN replacing the default level pattern
For logback we also support logging.pattern.level as a synonym. Fixes gh-4062
This commit is contained in:
@@ -63,6 +63,7 @@ content into your application; rather pick only the properties that you need.
|
||||
logging.path=/var/log
|
||||
logging.pattern.console= # appender pattern for output to the console (only supported with the default logback setup)
|
||||
logging.pattern.file= # appender pattern for output to the file (only supported with the default logback setup)
|
||||
logging.pattern.level= # appender pattern for the log level (default %5p, only supported with the default logback setup)
|
||||
|
||||
# IDENTITY ({sc-spring-boot}/context/ContextIdApplicationContextInitializer.{sc-ext}[ContextIdApplicationContextInitializer])
|
||||
spring.application.name=
|
||||
|
||||
@@ -1085,6 +1085,18 @@ To help with the customization some other properties are transferred from the Sp
|
||||
|`LOG_PATH`
|
||||
|Used in default log configuration if defined.
|
||||
|
||||
|`logging.pattern.console`
|
||||
|`CONSOLE_LOG_PATTERN`
|
||||
|The log pattern to use on the console (stdout). (Not supported with JDK logger.)
|
||||
|
||||
|`logging.pattern.file`
|
||||
|`FILE_LOG_PATTERN`
|
||||
|The log pattern to use in a file (if LOG_FILE enabled). (Not supported with JDK logger.)
|
||||
|
||||
|`logging.pattern.level`
|
||||
|`LOG_LEVEL_PATTERN`
|
||||
|The format to use to render the log level (default `%5p`). (The `logging.pattern.level` form is only supported by Logback.)
|
||||
|
||||
|`PID`
|
||||
|`PID`
|
||||
|The current process ID (discovered if possible and when not already defined as an OS
|
||||
@@ -1095,6 +1107,20 @@ To help with the customization some other properties are transferred from the Sp
|
||||
All the logging systems supported can consult System properties when parsing their
|
||||
configuration files. See the default configurations in `spring-boot.jar` for examples.
|
||||
|
||||
[TIP]
|
||||
====
|
||||
|
||||
You can add MDC and other ad-hoc content to log lines by overriding
|
||||
only the `LOG_LEVEL_PATTERN` (or `logging.pattern.level` with
|
||||
Logback). For example, if you use `logging.pattern.level=user:%X{user}
|
||||
%5p` then the default log format will contain an MDC entry for "user"
|
||||
if it exists, e.g.
|
||||
|
||||
----
|
||||
2015-09-30 12:30:04.031 user:juergen INFO 22174 --- [ nio-8080-exec-0] demo.Controller Handling authenticated request
|
||||
----
|
||||
====
|
||||
|
||||
|
||||
|
||||
[[boot-features-logback-extensions]]
|
||||
|
||||
Reference in New Issue
Block a user