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

Ralph Goers commented on LOG4J2-2003:
-------------------------------------

Is there a reason MyApp.log can't be configured as a property like logdir is?

> Hierarchical component properties
> ---------------------------------
>
>                 Key: LOG4J2-2003
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2003
>             Project: Log4j 2
>          Issue Type: Wish
>          Components: Configurators
>    Affects Versions: 2.8.2
>            Reporter: Paul Burrowes
>            Priority: Minor
>
> It would be very nice when configuring multiple appenders with complex 
> configuration to be able to substitute properties defined in the appender 
> section. Being able to create local properties within an appender config 
> would remove the need to have the log filename repeated in each attribute 
> that uses a variant on it.
> The current config only allows properties at the global level thus requires 
> the log filename to be repeated multiple times e.g. in this configuration the 
> string "MyApp.log" must be repeated three times to construct a 
> RollingFileAppender with a delete action.
> {noformat}
> <Configuration name="MyApp Configuration" status="ERROR">
>   <Properties>
>     <Property name="MyAppVersionHeader">%d{yyyy-MM-dd HH:mm:ss.SSS} 
> ${VERSION} log file started\n</Property>
>     <Property name="logDir">${sys:MyApp.dir.work}/log</Property>
>     <Property name="VERSION">1c91bff2e</Property>
>     <Property name="maxArchivedFiles">4</Property>
>   </Properties>
>     <RollingFile name="MyAppLog" filePattern="${logDir}/MyApp.log.%i" 
> fileName="${logDir}/MyApp.log">
>       <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSSZ} %-7level [%logger] 
> &lt;%threadName&gt; %mdc %msg%n%throwable" header="${MyAppVersionHeader}"/>
>       <SizeBasedTriggeringPolicy size="100MB"/>
>       <DefaultRolloverStrategy min="1" max="2147483647">
>         <Delete maxDepth="1" basePath="${logDir}">
>           <IfAccumulatedFileCount exceeds="${maxArchivedFiles}"/>
>           <IfFileName glob="MyApp.log.*"/>
>         </Delete>
>       </DefaultRolloverStrategy>
>     </RollingFile>
> ...
> </{noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to