Dear, all!

I need to trigger rolling log every hour and size-based. And i don't want the 
log files grow without bound.
Amazing! Log4j2 provide the delete action to finish the job, so cool!

But after i run the app for 2 days, apparently the delete action does not work

Here is my configuration, with this configuration only the foo2 worked, foo1 
not.
So I want to know does only one "delete" is permiteed?

                <RollingRandomAccessFile name="FOO1"
fileName="${baseDir}/foo1/foo1.log" 
filePattern="${baseDir}/foo1/foo1.%d{yyyy-MM-dd-HH}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
<SizeBasedTriggeringPolicy size="200 MB" />
</Policies>
<DefaultRolloverStrategy>
<!-- Nested conditions: the inner condition is only evaluated on files 
for which the outer conditions are true. -->
<Delete basePath="${baseDir}/foo1" maxDepth="2">
<IfFileName glob="*.log">
<IfLastModified age="1d">
<IfAny>
<IfAccumulatedFileSize exceeds="50GB" />
</IfAny>
</IfLastModified>
</IfFileName>
</Delete>
</DefaultRolloverStrategy>
</RollingRandomAccessFile>
<RollingRandomAccessFile name="FOO2"
fileName="${baseDir}/foo2/foo2.log"
filePattern="${baseDir}/foo2/foo2.%d{yyyy-MM-dd-HH}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
<SizeBasedTriggeringPolicy size="200 MB" />
</Policies>
<DefaultRolloverStrategy>
<!-- Nested conditions: the inner condition is only evaluated on files 
for which the outer conditions are true. -->
<Delete basePath="${baseDir}/foo2" maxDepth="2">
<IfFileName glob="*.log">
<IfLastModified age="1d">
<IfAny>
<IfAccumulatedFileSize exceeds="50GB" />
</IfAny>
</IfLastModified>
</IfFileName>
</Delete>
</DefaultRolloverStrategy>
</RollingRandomAccessFile> 

Best Regards!

Jingych


---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any 
accompanying attachment(s)
is intended only for the use of the intended recipient and may be confidential 
and/or privileged of
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of 
this communication is
not the intended recipient, unauthorized use, forwarding, printing,  storing, 
disclosure or copying
is strictly prohibited, and may be unlawful.If you have received this 
communication in error,please
immediately notify the sender by return e-mail, and delete the original message 
and all copies from
your system. Thank you.
---------------------------------------------------------------------------------------------------

Reply via email to