Browse Source

Honor logging.path config in filePattern for Log4j2 RollingFile

Previously, rolled over files were always written to logs/. This
commit ensures that rotated logs are written into the directory
specified in the application config's logging.path property.

Closes gh-10554
pull/10588/merge
Sebastian Thomschke 8 years ago committed by Andy Wilkinson
parent
commit
7441d6bd86
  1. 2
      spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file.xml

2
spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file.xml

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
<Console name="Console" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="${sys:CONSOLE_LOG_PATTERN}" />
</Console>
<RollingFile name="File" fileName="${sys:LOG_FILE}" filePattern="logs/$${date:yyyy-MM}/app-%d{yyyy-MM-dd-HH}-%i.log.gz">
<RollingFile name="File" fileName="${sys:LOG_FILE}" filePattern="${sys:LOG_PATH}/$${date:yyyy-MM}/app-%d{yyyy-MM-dd-HH}-%i.log.gz">
<PatternLayout>
<Pattern>${sys:FILE_LOG_PATTERN}</Pattern>
</PatternLayout>

Loading…
Cancel
Save