spring 2.4.x the logging config doesn't take effect. when I change the version to 2.3.x,it works,the config are as follows: only one configuration
logging.file.name = ./logs/xxx.log
or two configurations
logging.file.path=./logs
logging.file.name = xxx.log
Comment From: snicoll
@cwtree unfortunately, the logging configuration you've provided works fine for me with both 2.3.x
and 2.4.x
. If you want support, please take the time to build a small sample that reproduces the behavior you've described. You can do so by attaching a zip to this issue or by sharing a link to a GitHub repository.
Comment From: cwtree
@cwtree unfortunately, the logging configuration you've provided works fine for me with both
2.3.x
and2.4.x
. If you want support, please take the time to build a small sample that reproduces the behavior you've described. You can do so by attaching a zip to this issue or by sharing a link to a GitHub repository.
here is a simple demo project to test,you can see the readme file https://github.com/cwtree/springboot-log-test/blob/main/README.md
Comment From: philwebb
I think the problem is you're missing %i
from the RollingFileAppender
. Logback isn't great at reporting the problem, but that pattern is madatory. If I change your application-dev.properties
to the following, then things work as expected:
logging.logback.rollingpolicy.file-name-pattern = ${LOG_FILE}/cube-boot.%d{yyyyMMdd}.%i.log
The reason it works in 2.3 is that the logging.logback.rollingpolicy.file-name-pattern
property is new. In 2.3 it was named logging.pattern.rolling-file-name
.
Comment From: cwtree
I think the problem is you're missing
%i
from theRollingFileAppender
. Logback isn't great at reporting the problem, but that pattern is madatory. If I change yourapplication-dev.properties
to the following, then things work as expected:
logging.logback.rollingpolicy.file-name-pattern = ${LOG_FILE}/cube-boot.%d{yyyyMMdd}.%i.log
The reason it works in 2.3 is that the
logging.logback.rollingpolicy.file-name-pattern
property is new. In 2.3 it was namedlogging.pattern.rolling-file-name
.
thank you,it works now;
by the way,I want to know how to output different log file by the springboot application config ,not logback.xml,because my project used ctrip.apollo to refresh config automatic,If I use logback.xml to config log,the config auto refresh will be very complicated,so when the springboot can define different log files according to packages.