[ 
https://issues.apache.org/jira/browse/LOG4J2-2353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513994#comment-16513994
 ] 

Ralph Goers commented on LOG4J2-2353:
-------------------------------------

I am curious - does it make any difference if the output files for the 
different appenders target different directories? I am just wondering if having 
both sets of files in the same directory is somehow causing the problem.

> log4j generate uncompressed .log.gz file with plain text when not all 
> filePattern are using compression
> -------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2353
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2353
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.9.1
>         Environment: CentOS & MacOS
> JVM 1.8 (reproducible on latest build)
>            Reporter: Julien
>            Priority: Trivial
>
> One appender filePattern is set with "*log.gz", another appender is set with 
> "*.log". In this case what is observed is that the log.gz rollover with no 
> compression, removing the appender with filePattern set with no compression 
> work around this
> Here is how log4j2.properties look like 
> {code:java}
> appender.rolling.type = RollingFile
> appender.rolling.name = plain_rolling
> appender.rolling.fileName = /path/plainlog.log
> appender.rolling.filePattern = /path/plainlog-%d{yyyy-MM-dd-HH-mm-ss}.log.gz
> appender.rolling.policies.type = Policies
> appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
> appender.rolling.policies.time.interval = 1
> appender.rolling.policies.time.modulate = true
> appender.rolling.layout.type = PatternLayout
> appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %-.10000m%n
> #This section/appender is not even used in the application as a setting is 
> logging in plain
> appender.json_rolling.type = RollingFile
> appender.json_rolling.name = json_rolling
> appender.json_rolling.fileName = /path/jsonlog.log
> appender.json_rolling.filePattern = /path/jsonlog-%d{yyyy-MM-dd-HH-mm-ss}.log
> appender.json_rolling.policies.type = Policies
> appender.json_rolling.policies.time.type = TimeBasedTriggeringPolicy
> appender.json_rolling.policies.time.interval = 1
> appender.json_rolling.policies.time.modulate = true
> appender.json_rolling.layout.type = JSONLayout
> appender.json_rolling.layout.compact = true
> appender.json_rolling.layout.eventEol = true
> {code}
>  
>  
> With above configuration the following files will contain plain text
> {code:java}
> /path/plainlog-%d{yyyy-MM-dd-HH-mm-ss}.log.gz{code}
> Commenting out appender "json_rolling" or setting filePattern to .log.gz 
> cause the plainlog-*.log.gz to be compressed as expected :
> {code:java}
> appender.json_rolling.filePattern = 
> /path/jsonlog-%d{yyyy-MM-dd-HH-mm-ss}.log{code}
>  
> I am expecting this is or was a Bug in log4j code or possibly documentation 
> because I could not see this behaviour is documented clearly 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to