logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aliaksandr Belavusau" <abelavu...@gmail.com>
Subject RE: Is it possible to declare filePattern attribute value without date?
Date Mon, 12 Aug 2013 15:36:28 GMT
Thank you, Ralph,

TimeBasedTriggeringPolicy tag is unnecessary in the case with
filePattern="logs/app.log.%i". I need to use  SizeBasedTriggeringPolicy
only.

Alex.

-----Original Message-----
From: Ralph Goers [mailto:ralph.goers@dslextreme.com] 
Sent: Monday, August 12, 2013 6:02 PM
To: Log4J Users List
Subject: Re: Is it possible to declare filePattern attribute value without
date?

The TimeBasedTriggeringPolicy needs the date to determine how frequently it
should roll over.  If you remove that then you should be able to remove the
date pattern.

Ralph

On Aug 12, 2013, at 7:33 AM, Aliaksandr Belavusau wrote:

> Hi guys,
> 
> 
> 
> Is it possible to declare filePattern attribute without date pattern?
> 
> 
> 
> <FastRollingFile name="LOGFILE" fileName="logs/app.log"
> filePattern="logs/app.log.%d{yyyy-MM-dd}.%i">
> 
>                  <ThresholdFilter level="DEBUG" onMatch="ACCEPT"
> onMismatch="DENY"/>
> 
>                  <PatternLayout>
> 
>                        <pattern>%d %5p [%t] %c ${ctx:Id} ${ctx:Code} - 
> %m%n</pattern>
> 
>                  </PatternLayout>
> 
>                  <Policies>
> 
>                        <TimeBasedTriggeringPolicy />
> 
>                        <SizeBasedTriggeringPolicy size="10 MB"/>
> 
>                  </Policies>
> 
>                  <DefaultRolloverStrategy max="100"/>
> 
>            </FastRollingFile>
> 
> 
> 
> I'd like to name files: app.log, app.log.0, app.log.1, : , app.log.n, 
> but with filePattern="logs/app.log.%i" IllegalStateException was thrown.
> 
> 
> 
> Caused by: java.lang.IllegalStateException: Pattern does not contain a 
> date
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.PatternProcessor.getNex
> tTime(
> PatternProcessor.java:88)
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPoli
> cy.ini
> tialize(TimeBasedTriggeringPolicy.java:49)
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPoli
> cy.ini
> tialize(CompositeTriggeringPolicy.java:43)
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.<ini
> t>(Rol
> lingFileManager.java:57)
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager.
> <init>
> (FastRollingFileManager.java:49)
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager$
> FastRo
> llingFileManagerFactory.createManager(FastRollingFileManager.java:158)
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager$
> FastRo
> llingFileManagerFactory.createManager(FastRollingFileManager.java:127)
> 
>        at
> org.apache.logging.log4j.core.appender.AbstractManager.getManager(Abst
> ractMa
> nager.java:71)
> 
>        at
> org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(
> Output
> StreamManager.java:65)
> 
>        at
> org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager.
> getFas
> tRollingFileManager(FastRollingFileManager.java:61)
> 
>        at
> org.apache.logging.log4j.core.appender.FastRollingFileAppender.createA
> ppende
> r(FastRollingFileAppender.java:201)
> 
>        ... 50 more
> 


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



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


Mime
View raw message