[jboss-jira] [JBoss JIRA] (LOGMGR-255) PeriodicRotatingFileHandler doesn't rotate log content when using Compression
Alain Baxter (Jira)
issues at jboss.org
Wed Jun 19 12:27:00 EDT 2019
[ https://issues.jboss.org/browse/LOGMGR-255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13749068#comment-13749068 ]
Alain Baxter commented on LOGMGR-255:
-------------------------------------
I'm using JBoss EAP 7.2.
I have done some additional testing after looking at https://github.com/jamezp/jboss-logmanager/blob/2.2/src/test/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandlerTests.java and noticing that it only tests with append = false.
When I modify my configuration to this that the rollover works correctly, however with append = true it does not, so the issue seems to be around this parameter with respect to compressing the rotated logs.
My suspicion is that without compression the code does a Files.move which removes the original log file, thus the Handler by default would create a new file, however with compressing, the code uses Input and Output stream to copy/compress the content of the original log file, but leaves the original log file unchanged. See: https://github.com/jboss-logging/jboss-logmanager/blob/2.2/src/main/java/org/jboss/logmanager/handlers/SuffixRotator.java starting from line 153 and following through the archiveGzip, archiveZip, and move methods. Thus the Handler would continue to append content to the same log file with compression configured on rotation.
> PeriodicRotatingFileHandler doesn't rotate log content when using Compression
> -----------------------------------------------------------------------------
>
> Key: LOGMGR-255
> URL: https://issues.jboss.org/browse/LOGMGR-255
> Project: JBoss Log Manager
> Issue Type: Bug
> Reporter: Alain Baxter
> Priority: Major
>
> When configuring a PeriodicRotatingFileHandler where the suffix ends with .zip or .gz, as such:
> {noformat}
> <periodic-rotating-file-handler name="FILE" autoflush="true">
> <formatter>
> <named-formatter name="PATTERN"/>
> </formatter>
> <file relative-to="jboss.server.log.dir" path="server.log"/>
> <suffix value=".yyyy-MM-dd-HH.gz"/>
> <append value="true"/>
> </periodic-rotating-file-handler>
> {noformat}
> This is supposed to compressed the rotated logs to save space. See https://issues.jboss.org/browse/LOGMGR-30
> What I'm seeing is that the rotation log file is successfully created and compressed at the periodic interval, however the log file content is not removed.
> This means that the log file itself continues to grow instead of rotating log content, and each rotation log contains the content from all the previous, so their size gets larger and larger:
> {noformat}
> -rw-r--r--. 1 jboss jboss 1779799 Jun 18 21:03 server.log
> -rw-r--r--. 1 jboss jboss 21831 Jun 18 19:00 server.log.2019-06-18-18.gz
> -rw-r--r--. 1 jboss jboss 55168 Jun 18 20:00 server.log.2019-06-18-19.gz
> -rw-r--r--. 1 jboss jboss 88021 Jun 18 21:00 server.log.2019-06-18-20.gz
> {noformat}
> *NOTE:* This issue would exist for SizeRotatingFileHandler and PeriodicSizeRotatingFileHandler
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list