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 "Remko Popma (JIRA)" <ji...@apache.org> on 2014/02/11 11:47:19 UTC

[jira] [Created] (LOG4J2-535) Rolled log files end up in the wrong directory

Remko Popma created LOG4J2-535:
----------------------------------

             Summary: Rolled log files end up in the wrong directory
                 Key: LOG4J2-535
                 URL: https://issues.apache.org/jira/browse/LOG4J2-535
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.0-rc1
         Environment: Ubuntu 12.04 and 13.04, java version "1.7.0_51"
            Reporter: Remko Popma


Follow-up for issue LOG4J2-531: the main issue (rolled over archives were overwritten) was resolved but the solution brought to light another issue that is tracked here.

Sample configuration based on that for LOG4J2-531, adjusted to roll every hour and every 64kb (i.e. expect similar number of files per folder):

{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Appenders>
        <RollingFile name="Test" fileName="logs/test.log" filePattern="logs/test/$${date:yyyyMMddHH}/TEST-%d{yyyyMMddHH}-%i.log.gz">
            <PatternLayout pattern="%d %p (%t) [%c] - %m%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="64 KB"/>
            </Policies>
            <DefaultRolloverStrategy max="99"/>
        </RollingFile>
    </Appenders>
    <Loggers>
        <Root level="debug">
            <AppenderRef ref="Test"/>
        </Root>
    </Loggers>
</Configuration>
{code}

Running this overnight gave a similar pattern, e.g. the folder for {{2014021100}} contains one file with timestamps {{00:59:42,836}} to {{00:59:59,851}}, and then 15 others covering timestamps {{01:00:00,101}} to {{01:59:24,196}}. Only the last file's worth for each hour (the one rotated based on time) is in the correct folder, and the rest (rotated based on size) are in the previous hour's folder.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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