[
https://issues.apache.org/jira/browse/LOG4J2-3258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462697#comment-17462697
]
Carter Kozak commented on LOG4J2-3258:
--------------------------------------
This is an intentional change to protect against user-provided data being used
to invoke unintentional lookups. When the configuration itself is parsed
initially, recursion is allowed to avoid breaking existing configurations.
However, the RoutingAppender routes are evaluated on a per-logevent basis,
which is capable of using logevent-based lookups.
[~kliakos] You can resolve the issue by flattening the lookups, which requires
a bit of duplication in the configuration, but ends up safer:
{code:xml}
<RollingFile name="Rolling-application" fileName="${logs_dir}/application.log"
filePattern="${logs_dir}/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
{code}
becomes
{code:xml}
<RollingFile name="Rolling-application"
fileName="${env:LOGS_DIRECTORY}/application.log"
filePattern="${env:LOGS_DIRECTORY}/${date:yyyy-MM}/default-%d{yyyy-MM-dd}-%i.log.gz">
{code}
[~BigMichi1] Can you please share the full configuration? I suspect your issue
can be resolved similarly.
> 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
>
> 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)