Allow auto-reload of log4j2 config
Log4j2 can auto-reload its configuration file as long as the reference to a `java.io.File` is provided in the `ConfigurationSource`. Previously, we always created such `ConfigurationSource` with only the URL regardless of its type. Detect when the configuration URL points to a File and create the `ConfigurationSource` accordingly. The `spring-boot-sample-actuator-log4j2` has been updated to reload the logging configuration every 30 sec if necessary. Fixes gh-3024, gh-3030
This commit is contained in:
committed by
Stephane Nicoll
parent
f0b203f6da
commit
04776232f7
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Configuration status="WARN" monitorInterval="30">
|
||||
<Properties>
|
||||
<Property name="PID">????</Property>
|
||||
<Property name="LOG_PATTERN">[%d{yyyy-MM-dd HH:mm:ss.SSS}] log4j2%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n</Property>
|
||||
|
||||
Reference in New Issue
Block a user