Provide a property to configure conversion word used to log exceptions
This commit adds a new property, logging.exception-conversion-word, that can be used to configure the conversion word that is used when logging exceptions. The default value, %rEx, will log exceptions with the root cause first and include class packaging information in the stack trace. The new property is supported when using either Logback or Log4J2. Closes gh-3684
This commit is contained in:
@@ -56,10 +56,11 @@ content into your application; rather pick only the properties that you need.
|
||||
spring.output.ansi.enabled=detect # Configure the ANSI output ("detect", "always", "never")
|
||||
|
||||
# LOGGING
|
||||
logging.path=/var/log
|
||||
logging.file=myapp.log
|
||||
logging.config= # location of config file (default classpath:logback.xml for logback)
|
||||
logging.exception-conversion-word=%rEx # conversion word used when logging exceptions
|
||||
logging.file=myapp.log
|
||||
logging.level.*= # levels for loggers, e.g. "logging.level.org.springframework=DEBUG" (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)
|
||||
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)
|
||||
|
||||
|
||||
@@ -1195,7 +1195,9 @@ These are:
|
||||
* `${PID}` the current process ID.
|
||||
* `${LOG_FILE}` if `logging.file` was set in Boot's external configuration.
|
||||
* `${LOG_PATH}` if `logging.path` was set (representing a directory for
|
||||
log files to live in).
|
||||
log files to live in).
|
||||
* `${LOG_EXCEPTION_CONVERSION_WORD}` if `logging.exception-conversion-word` was set in
|
||||
Boot's external configuration.
|
||||
|
||||
Spring Boot also provides some nice ANSI colour terminal output on a console (but not in
|
||||
a log file) using a custom Logback converter. See the default `base.xml` configuration
|
||||
|
||||
@@ -1068,6 +1068,10 @@ To help with the customization some other properties are transferred from the Sp
|
||||
|===
|
||||
|Spring Environment |System Property |Comments
|
||||
|
||||
|`logging.exception-conversion-word`
|
||||
|`LOG_EXCEPTION_CONVERSION_WORD`
|
||||
|The conversion word that's used when logging exceptions.
|
||||
|
||||
|`logging.file`
|
||||
|`LOG_FILE`
|
||||
|Used in default log configuration if defined.
|
||||
|
||||
Reference in New Issue
Block a user