-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Log4j2 configuration is not picking up some properties #22983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There's a class called |
@philwebb exactly! Seems <?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<Property name="CONSOLE_LOG_PATTERN">%clr{%d{${sys:LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}}{faint} %clr{${sys:LOG_LEVEL_PATTERN:-%5p}} %clr{%pid}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD:-%xwEx}</Property>
<Property name="FILE_LOG_PATTERN">%d{${sys:LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${sys:LOG_LEVEL_PATTERN:-%5p} %pid --- [%t] %-40.40c{1.} : %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD:-%xwEx}</Property>
</Properties>
<!-- ... ->
</Configuration> As you can see, I removed declarations of |
I'm using log4j2 for logging and tried to simplify the logging pattern by setting
logging.pattern.dateformat
toHH:mm:ss.SSS
.build.gradle
:However, the date format remains unchanged -
yyyy-MM-dd HH:mm:ss.SSS
.I tried to debug the application and found out that
log4j2.xml
file has these lines:spring-boot/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml
Lines 7 to 8 in 0fce280
At the same time, Logback configuration is a bit different:
spring-boot/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml
Line 12 in 0fce280
When I put my custom
log4j.xml
file on the classpath, it started working fine:Shouldn't
CONSOLE_LOG_PATTERN
property be defined in a way like this?I suppose, the same is about
LOG_EXCEPTION_CONVERSION_WORD
andLOG_LEVEL_PATTERN
properties. WDYT?The text was updated successfully, but these errors were encountered: