You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2014/03/20 07:36:42 UTC

[jira] [Commented] (LOG4J2-573) TimeBasedTriggeringPolicy does not accept %i increment FilePattern

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

Ralph Goers commented on LOG4J2-573:
------------------------------------

I'm tempted to close this as Invalid based on your report but since you created it as an improvement I am not sure if you think this is a bug or an enhancement request.

The time-based triggering policy requires a time pattern to determine the frequency to rollover.  In your configuration you have an interval of 12.  Is that 12 seconds, minutes, hours or years?  The policy obtains that information by looking at the pattern and using the smallest time unit in it.  Since the policy cannot determine the rollover frequency it is appropriate for it to throw a Log4j exception.

In short, your configuration could never be valid.  Without a time pattern the policy would require another attribute to allow the time unit to be specified. However that also requires deciding what should happen if both the attribute and time pattern are present and they don't agree.

> TimeBasedTriggeringPolicy does not accept %i increment FilePattern
> ------------------------------------------------------------------
>
>                 Key: LOG4J2-573
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-573
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 2.0-rc1
>            Reporter: Steven McCoy
>            Priority: Minor
>
> The following configuration should be valid but raises an exception because the filePattern contains no date however it does contain an increment pattern.
>     <RollingRandomAccessFile name="File" fileName="${filename}"
>         filePattern="logs/icap.log-%i">
>       <PatternLayout pattern="%m%n"/>
>       <Policies>
>         <OnStartupTriggeringPolicy />
>         <TimeBasedTriggeringPolicy interval="12" modulate="true"/>
>         <SizeBasedTriggeringPolicy size="500 MB"/>
>       </Policies>
>       <DefaultRolloverStrategy fileIndex="min" max="3"/>
>     </RollingRandomAccessFile>



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org