[
https://issues.apache.org/jira/browse/LOG4J2-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17463061#comment-17463061
]
Michael Cramer commented on LOG4J2-3258:
----------------------------------------
These are our configuration files:
[^log4j2.xml]
[^log4j2-appender-routing.xml]
[~rgoers] I can not really tell you why there is the $$ but yes should be only
one because in the end the system property {{storage.root}} already contains
the complete servlet context path
I'm not sure if log4j-spring-boot will help with that scenario, it more looks
like the log4j-web (${web:contextPath}) can help but it is also hard to manage
to get the correct servlet listeners/initializers into the correct order when
working with a plain spring boot application which can be run as a standalone
one and also deployed into a servlet container
just a brief overview what we have see how it works together (might be
incomplete)
* spring boot application starts
* logging system (log4j2) will be initialized/configured (at that time the
system property does not exist, so the placeholder will not be touched and
stays in the filename)
* ServletContextListener is called to set the system property {{storage.root}}
with the current context path
* a log statement is called on the ServletContext which triggers the file
creation for file (here the name still contains the lookup and will not be
resolved)
> RollingFile fileName containing variables does not work on 2.17.0
> -----------------------------------------------------------------
>
> Key: LOG4J2-3258
> URL: https://issues.apache.org/jira/browse/LOG4J2-3258
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.17.0
> Environment: Java 17, Ubuntu 20.04.
> Reporter: Konstantinos Liakos
> Priority: Major
> Attachments: log4j2-appender-routing.xml, log4j2.xml
>
>
> A configuration like the below has stopped working since 2.17.0. The
> variables that originate from <Properties> are not resolved to their actual
> values.
> {code:xml}
> <Property name="logs_dir">$${env:LOGS_DIRECTORY}</Property> {code}
> {code:xml}
> <RollingFile name="Rolling-${ctx:logFile}"
> fileName="${logs_dir}/${ctx:logFile}"{code}
>
> Works fine on 2.16.0.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)