Discussion:
[jira] [Created] (LOG4J2-524) Rollover does not delete older archives
Remko Popma (JIRA)
2014-02-01 04:22:08 UTC
Permalink
Remko Popma created LOG4J2-524:
----------------------------------

Summary: Rollover does not delete older archives
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma


This issue was raised by Kireet on the log4j-user mailing list:

I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.

{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}




--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 04:44:09 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma updated LOG4J2-524:
-------------------------------

Description:
This issue was raised by Kireet on the log4j-user mailing list:

I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.

{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}


was:
This issue was raised by Kireet on the log4j-user mailing list:

I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.

{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
Post by Remko Popma (JIRA)
Rollover does not delete older archives
---------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 05:12:09 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13888459#comment-13888459 ]

Remko Popma commented on LOG4J2-524:
------------------------------------

I thought this might be a bug but it seems like everything works correctly. To clarify:
the {{filePattern="app-%d\{yyyy-MM-dd}.%i.log"}} has two parts for rollover: a date part ({{yyyy-MM-dd}}) and an index part ({{%i}}).
The date part is used by {{TimeBasedTriggeringPolicy}}.
The index part is used by {{SizeBasedTriggeringPolicy}} *if one is configured*.

If you configure both a SizeBased and a TimeBased triggering policy, then you can have multiple rollovers within the same time period. In that case, the {{<DefaultRolloverStrategy max="3"/>}} config will only keep the 3 most recent rolled over files _within the same time period_.

For example, this config:
{code}
<RollingFile name="RollingFile" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd_HH-mm-ss}.%i.log"> <!-- roll over every second -->
<PatternLayout>
<Pattern>%d %p %c [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="5 b"/> <!-- roll over if log file size exceeds 5 bytes -->
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}

With this test program:
{code}
Logger logger = LogManager.getLogger();
for (int i = 0; i < 10; i++) {
Thread.sleep(100);
logger.info("test " + i);
}
{code}
Gives this output:
{code}
app-2014-02-01_14-07-41.1.log
app-2014-02-01_14-07-41.2.log
app-2014-02-01_14-07-41.3.log
app-2014-02-01_14-07-42.1.log
app-2014-02-01_14-07-42.2.log
app-2014-02-01_14-07-42.3.log
app.log
{code}

The logic for removing old rolled-over log files is based on the file name, and a file is only removed if a renaming action would result in a file name that already exists. If you only have TimeBasedTriggeringPolicy, the renaming action always results in a file name that does not exist yet, so older files are never removed.
Post by Remko Popma (JIRA)
Rollover does not delete older archives
---------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 05:12:09 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma updated LOG4J2-524:
-------------------------------

Fix Version/s: 2.0-beta9
Summary: Rollover does not delete older rolled over files (was: Rollover does not delete older archives)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 05:16:08 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma closed LOG4J2-524.
------------------------------
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 05:16:09 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma reopened LOG4J2-524:
--------------------------------
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 05:16:09 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13888459#comment-13888459 ]

Remko Popma edited comment on LOG4J2-524 at 2/1/14 5:15 AM:
------------------------------------------------------------

I thought this might be a bug but it seems like everything works correctly. To clarify:
the {{filePattern="app-%d\{yyyy-MM-dd}.%i.log"}} has two parts for rollover: a date part ({{yyyy-MM-dd}}) and an index part ({{%i}}).
The date part is used by {{TimeBasedTriggeringPolicy}}.
The index part is used by {{SizeBasedTriggeringPolicy}} *if one is configured*.

If you configure both a SizeBased and a TimeBased triggering policy, then you can have multiple rollovers within the same time period. In that case, the {{<DefaultRolloverStrategy max="3"/>}} config will only keep the 3 most recent rolled over files _within the same time period_.

For example, this config:
{code}
<RollingFile name="RollingFile" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd_HH-mm-ss}.%i.log"> <!-- roll over every second -->
<PatternLayout>
<Pattern>%d %p %c [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="5 b"/> <!-- roll over if log file size exceeds 5 bytes -->
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}

With this test program:
{code}
Logger logger = LogManager.getLogger();
for (int i = 0; i < 20; i++) {
Thread.sleep(100);
logger.info("test " + i);
}
{code}
Gives this output:
{code}
app-2014-02-01_14-07-41.1.log
app-2014-02-01_14-07-41.2.log
app-2014-02-01_14-07-41.3.log
app-2014-02-01_14-07-42.1.log
app-2014-02-01_14-07-42.2.log
app-2014-02-01_14-07-42.3.log
app.log
{code}

The logic for removing old rolled-over log files is based on the file name, and a file is only removed if a renaming action would result in a file name that already exists. If you only have TimeBasedTriggeringPolicy, the renaming action always results in a file name that does not exist yet, so older files are never removed.


was (Author: ***@yahoo.com):
I thought this might be a bug but it seems like everything works correctly. To clarify:
the {{filePattern="app-%d\{yyyy-MM-dd}.%i.log"}} has two parts for rollover: a date part ({{yyyy-MM-dd}}) and an index part ({{%i}}).
The date part is used by {{TimeBasedTriggeringPolicy}}.
The index part is used by {{SizeBasedTriggeringPolicy}} *if one is configured*.

If you configure both a SizeBased and a TimeBased triggering policy, then you can have multiple rollovers within the same time period. In that case, the {{<DefaultRolloverStrategy max="3"/>}} config will only keep the 3 most recent rolled over files _within the same time period_.

For example, this config:
{code}
<RollingFile name="RollingFile" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd_HH-mm-ss}.%i.log"> <!-- roll over every second -->
<PatternLayout>
<Pattern>%d %p %c [%t] %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="5 b"/> <!-- roll over if log file size exceeds 5 bytes -->
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}

With this test program:
{code}
Logger logger = LogManager.getLogger();
for (int i = 0; i < 10; i++) {
Thread.sleep(100);
logger.info("test " + i);
}
{code}
Gives this output:
{code}
app-2014-02-01_14-07-41.1.log
app-2014-02-01_14-07-41.2.log
app-2014-02-01_14-07-41.3.log
app-2014-02-01_14-07-42.1.log
app-2014-02-01_14-07-42.2.log
app-2014-02-01_14-07-42.3.log
app.log
{code}

The logic for removing old rolled-over log files is based on the file name, and a file is only removed if a renaming action would result in a file name that already exists. If you only have TimeBasedTriggeringPolicy, the renaming action always results in a file name that does not exist yet, so older files are never removed.
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 05:16:08 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma resolved LOG4J2-524.
--------------------------------

Resolution: Not A Problem

I'm closing this issue as "not a problem".
Please feel free to re-open if I missed something.
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-01 05:16:09 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma closed LOG4J2-524.
------------------------------

Resolution: Not A Problem
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Remko Popma (JIRA)
2014-02-09 09:13:19 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma reopened LOG4J2-524:
--------------------------------


Reopening this after discussion on ML clarified that this is a feature request to support keeping some max number of older log files for date-based patterns.

This feature would delete older log files, perhaps based on some {{maxAge}} configuration parameter, similar to the current {{max}} index-based deletion logic (that now only works for size-based rollover within a time period).

(Perhaps the title and description of this ticket should be updated to clarify the request.)
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
Matt Sicker (JIRA)
2014-03-13 19:37:45 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Sicker updated LOG4J2-524:
-------------------------------

Affects Version/s: 2.0-rc1
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Remko Popma (JIRA)
2014-06-20 05:03:24 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma updated LOG4J2-524:
-------------------------------

Labels: Rollover (was: )
Post by Remko Popma (JIRA)
Rollover does not delete older rolled over files
------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Labels: Rollover
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Remko Popma (JIRA)
2014-07-11 02:34:04 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma updated LOG4J2-524:
-------------------------------

Issue Type: Improvement (was: Bug)
Summary: Feature request: auto-delete older rolled over files (was: Rollover does not delete older rolled over files)

Updated title.
Feature request: auto-delete older rolled over files
----------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Improvement
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Labels: Rollover
Fix For: 2.0-beta9
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Remko Popma (JIRA)
2014-07-18 12:29:04 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma updated LOG4J2-524:
-------------------------------

Fix Version/s: (was: 2.0-beta9)
2.1
Post by Remko Popma (JIRA)
Feature request: auto-delete older rolled over files
----------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Improvement
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Labels: Rollover
Fix For: 2.1
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Remko Popma (JIRA)
2014-09-20 06:11:33 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma updated LOG4J2-524:
-------------------------------
Fix Version/s: (was: 2.1)
2.2
Post by Remko Popma (JIRA)
Feature request: auto-delete older rolled over files
----------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Improvement
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Labels: Rollover
Fix For: 2.2
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Naveen Velicheti (JIRA)
2014-09-29 20:11:35 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14152192#comment-14152192 ]

Naveen Velicheti commented on LOG4J2-524:
-----------------------------------------

Hi,
Did we create any fix for this?
I am also looking for deleting my old files which are rolled over based on time (Every Day in my case).
That maxAge parameter seems good to me. But is that implemented in any beta version?
Post by Remko Popma (JIRA)
Feature request: auto-delete older rolled over files
----------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Improvement
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Labels: Rollover
Fix For: 2.2
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Naveen Velicheti (JIRA)
2014-09-29 20:24:35 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14152192#comment-14152192 ]

Naveen Velicheti edited comment on LOG4J2-524 at 9/29/14 8:24 PM:
------------------------------------------------------------------

Hi,
Is there any fix created for this?
I am also looking for deleting my old files which are rolled over based on time (Every Day in my case).
That maxAge parameter seems good to me. But is that implemented in any beta version?


was (Author: vsnaveen1):
Hi,
Did we create any fix for this?
I am also looking for deleting my old files which are rolled over based on time (Every Day in my case).
That maxAge parameter seems good to me. But is that implemented in any beta version?
Post by Remko Popma (JIRA)
Feature request: auto-delete older rolled over files
----------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Improvement
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Labels: Rollover
Fix For: 2.2
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
Remko Popma (JIRA)
2014-09-30 00:43:34 UTC
Permalink
[ https://issues.apache.org/jira/browse/LOG4J2-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14152620#comment-14152620 ]

Remko Popma commented on LOG4J2-524:
------------------------------------

The maxAge parameter is just an idea. Other ideas (LOG4J2-435) may work too.
This request comes up regularly, but nobody has had time to work on this.
If you are interested, providing a patch would increase the chances of this issue being addressed.
Post by Remko Popma (JIRA)
Feature request: auto-delete older rolled over files
----------------------------------------------------
Key: LOG4J2-524
URL: https://issues.apache.org/jira/browse/LOG4J2-524
Project: Log4j 2
Issue Type: Improvement
Components: Appenders
Affects Versions: 2.0-beta9, 2.0-rc1
Reporter: Remko Popma
Labels: Rollover
Fix For: 2.2
I am trying to use the rolling file appender in log4j2, basically I want to roll at midnight daily and keep 3 old log files. New files are created properly, but log4j doesn't seem to be cleaning up the old files. Does log4j only support cleanup of files within the time period? Here is the relevant portion of the config. I tried things with and without the %i pattern.
{code}
<RollingFile name="Event" fileName="app.log"
filePattern="app-%d{yyyy-MM-dd}.%i.log">
<PatternLayout>
<Pattern>%m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
<DefaultRolloverStrategy compressionLevel="0" max="3"/>
</RollingFile>
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Loading...