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
This commit is contained in:
Sebastian Thomschke
2017-10-08 22:39:16 +02:00
committed by Andy Wilkinson
parent c0d9adce7e
commit 7441d6bd86

View File

@@ -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>