[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4j-dev
Subject:    [Bug 53417] New: Extras TimeBasedRollingPolicy does not compress log files
From:       bugzilla () apache ! org
Date:       2012-06-14 19:30:57
Message-ID: bug-53417-31091 () https ! issues ! apache ! org/bugzilla/
[Download RAW message or body]

https://issues.apache.org/bugzilla/show_bug.cgi?id=53417

          Priority: P2
            Bug ID: 53417
                CC: log4j-dev@logging.apache.org
          Assignee: log4j-dev@logging.apache.org
           Summary: Extras TimeBasedRollingPolicy does not compress log
                    files
          Severity: normal
    Classification: Unclassified
          Reporter: krisztian.kocsis@optimaster.eu
          Hardware: PC
            Status: NEW
           Version: 1.2
         Component: Companions
           Product: Log4j

The TimeBasedRollingPolicy does not compress log files with the following file
name pattern: "C:\Test\Logs\%d.log.zip"

Example:

On 2012-06-12 this file is created: C:\Test\Logs\2012-06-12.log
On 2012-06-14 this file is created: C:\Test\Logs\2012-06-14.log

Unfortunately the 2012-06-12.log didn't get compressed.
Note that the application didn't run at midnight.

Here is how the I initialize the logger:

    final org.apache.log4j.Logger rootLogger =
org.apache.log4j.Logger.getRootLogger();

    rootLogger.getLoggerRepository().resetConfiguration();
    rootLogger.setLevel(useDebugLog ? Level.DEBUG : Level.INFO);

    final PatternLayout          commonPatternLayout      = new
PatternLayout("%d{ISO8601} [%t] (%c) %p - %m%n");
    final TimeBasedRollingPolicy dailyRollingFilePolicy   = new
TimeBasedRollingPolicy();
    final RollingFileAppender    dailyRollingFileAppender = new
RollingFileAppender();

    dailyRollingFilePolicy.setFileNamePattern("C:\Test\Logs\%d.log.zip");
    dailyRollingFilePolicy.activateOptions();

    dailyRollingFileAppender.setEncoding("UTF-8");
    dailyRollingFileAppender.setLayout(commonPatternLayout);
    dailyRollingFileAppender.setRollingPolicy(dailyRollingFilePolicy);
    dailyRollingFileAppender.activateOptions();

    rootLogger.addAppender(dailyRollingFileAppender);

Log4J: 1.2.17, extras: 1.1, Java 7u4

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic