You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Benjamin Jaton <be...@gmail.com> on 2015/07/24 21:17:15 UTC
File monitor - reload DefaultRolloverStrategy
Hello,
I am using this configuration :
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG"* monitorInterval="2"*>
<Appenders>
<RollingFile name="RollingFile" fileName="/tmp/test/app.log"
filePattern="/tmp/test/app.log.%i">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="100KB"/>
</Policies>
*<DefaultRolloverStrategy max="5"/>*
</RollingFile>
</Appenders>
<Loggers>
<Root level="info" includeLocation="false">
<AppenderRef ref="RollingFile"/>
</Root>
</Loggers>
</Configuration>
I am changing the DefaultRolloverStrategy "max" attribute from 5 to 10.
I can see the reloading take place from the StatusLogger (full log
attached):
*DEBUG Starting configuration
XmlConfiguration[location=/usr/local/apps/log4j2-test.xml](...)DEBUG Found
factory method [createStrategy]: public static
org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy
org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.createStrategy(java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.apache.logging.log4j.core.config.Configuration).2015-07-24
12:08:00,938 DEBUG Calling createStrategy on class
org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy for
element DefaultRolloverStrategy with params(name="10", name="null",
name="null", name="null", Configuration(/usr/local/apps/log4j2-test.xml))*
So I think it sees my changes, however there is still only 5 files produces
1->5.
(I made sure that I was producing enough log data)
If I change the message pattern, I see it change in the log file, but not
the RolloverStrategy parameters.
Any idea what is going on?
Thanks
Ben
Re: File monitor - reload DefaultRolloverStrategy
Posted by Benjamin Jaton <be...@gmail.com>.
Whoops, here are the logs.
On Fri, Jul 24, 2015 at 12:17 PM, Benjamin Jaton <be...@gmail.com>
wrote:
> Hello,
>
> I am using this configuration :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="DEBUG"* monitorInterval="2"*>
> <Appenders>
> <RollingFile name="RollingFile" fileName="/tmp/test/app.log"
> filePattern="/tmp/test/app.log.%i">
> <PatternLayout>
> <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
> </PatternLayout>
> <Policies>
> <SizeBasedTriggeringPolicy size="100KB"/>
> </Policies>
> *<DefaultRolloverStrategy max="5"/>*
> </RollingFile>
> </Appenders>
> <Loggers>
> <Root level="info" includeLocation="false">
> <AppenderRef ref="RollingFile"/>
> </Root>
> </Loggers>
> </Configuration>
>
> I am changing the DefaultRolloverStrategy "max" attribute from 5 to 10.
> I can see the reloading take place from the StatusLogger (full log
> attached):
>
>
>
>
> *DEBUG Starting configuration
> XmlConfiguration[location=/usr/local/apps/log4j2-test.xml](...)DEBUG Found
> factory method [createStrategy]: public static
> org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy
> org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.createStrategy(java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.apache.logging.log4j.core.config.Configuration).2015-07-24
> 12:08:00,938 DEBUG Calling createStrategy on class
> org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy for
> element DefaultRolloverStrategy with params(name="10", name="null",
> name="null", name="null", Configuration(/usr/local/apps/log4j2-test.xml))*
>
> So I think it sees my changes, however there is still only 5 files
> produces 1->5.
>
> (I made sure that I was producing enough log data)
>
> If I change the message pattern, I see it change in the log file, but not
> the RolloverStrategy parameters.
> Any idea what is going on?
>
> Thanks
> Ben
>
>