[ 
https://issues.apache.org/jira/browse/LOG4J2-3317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17489113#comment-17489113
 ] 

ASF subversion and git services commented on LOG4J2-3317:
---------------------------------------------------------

Commit 17a77f5c27bda545de4b8eda46590401313e0be8 in logging-log4j2's branch 
refs/heads/release-2.x from Carter Kozak
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=17a77f5 ]

LOG4J2-3317: Fix RoutingAppender backcompat and improve lookup security

This change unifies our configuration-time and runtime property
handling logic in order to make configuration-time properties
safer and more obvious, while allowing RoutingAppender configurations
that were broken by 2.17.1 to work as expected once again.

This is done using two high-level ideas:
1. Properties defined in the configuration are aware of lookups,
   so the lookup-engine may resolve properties defined in the
   top level logging configuraton recursively. This applies only
   to the property literal, not the result of lookups used within
   configuration properties.
2. No recursive evaluation of lookup results. While properties are
   a special case, the data returned from other sources must not
   itself be evaluated. This matches the restriction we introduced
   in 2.17.1 for runtime lookups, however it applies everywhere
   and shouldn't result in breaks due to property traversal being
   allowed.

This introduces some level of risk, unlike the changes
in 2.17.1, this update the behavior of all lookups and is not
bounded to less-common runtime lookups.
We do not expect this to break users configurations, however
there are some cases in which we have intentionally changed
behavior:

Given environment `FOO=${lower:BAR}`
Using `<File name="${env:FOO}">` in a configuration will result
in a File appender with the literal name `${lower:BAR}` where
it would have previously evaluated to `bar`. This resolves an
ambiguity problem where those setting environment variables
don't need to be aware of log4j2 or our lookup syntax.


> After 2.17.1 upgarde, Route appenders with dynamic file writing are not 
> working . 
> ----------------------------------------------------------------------------------
>
>                 Key: LOG4J2-3317
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3317
>             Project: Log4j 2
>          Issue Type: Bug
>         Environment: spring boot log4j2.
> deployed on wildfly server.
>            Reporter: Srinivasa Babu
>            Assignee: Carter Kozak
>            Priority: Major
>
> Hello Sir,
> With log4j2 2.13.3 , Route appenders with context pattern checks for dynamic 
> file writing are working fine. After 2.17.1 the functionality is broken.
> I have upgraded to 2.17.1 and our java code, I am setting the ROUTINGKEY in 
> threadcontext map. Also i set the system properties,  
> log4j2.enableJndiLookup, log4j2.enableJndiJms, and 
> log4j2.enableJndiContextSelector to true for all said tags after 2.17.1 
> upgrade.
> When I check output file, its not writing the logs to Route File what we 
> specify but general RollingFile logger appenders are working fine. Please let 
> me know if you have faced this issue or any mitigation plan? Please let me 
> know if you want any logs and i will share those if there is any specific 
> procedure given. 
>  
> Calling the below Route from Async logging.
> here my example xml used the same as given in log4j2 documentaion.
> <Route key="$${ctx:ROUTINGKEY}">
> <RollingFile name="Rolling-default" fileName="logs/default.log"
> filePattern="./logs/${date:yyyy-MM}/default-%d\{yyyy-MM-dd}-%i.log.gz">
> <PatternLayout>
> <pattern>%d\{ISO8601} [%t] %p %c\{3} - %m%n</pattern>
> </PatternLayout>
> <Policies>
> <TimeBasedTriggeringPolicy interval="6" modulate="true" />
> <SizeBasedTriggeringPolicy size="10 MB" />
> </Policies>
> </RollingFile>
> </Route>
> <Route>
> <RollingFile name="Rolling-${ctx:ROUTINGKEY}" 
> fileName="logs/other-${ctx:ROUTINGKEY}.log"
> filePattern="./logs/${date:yyyy-MM}/${ctx:ROUTINGKEY}{-}other{-}%d\{yyyy-MM-dd}-%i.log.gz">
> <PatternLayout>
> <pattern>%d\{ISO8601} [%t] %p %c\{3} - %m%n</pattern>
> </PatternLayout>
> <Policies>
> <TimeBasedTriggeringPolicy interval="6" modulate="true" />
> <SizeBasedTriggeringPolicy size="10 MB" />
> </Policies>
> </RollingFile>
> </Route>
> </Routes>
> </Routing>
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to