[
https://issues.apache.org/jira/browse/LOG4J2-2353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16514029#comment-16514029
]
Julien edited comment on LOG4J2-2353 at 6/15/18 4:17 PM:
---------------------------------------------------------
[[email protected]] Thanks for the question, there is no change if
folders are different...
appender.json_rolling.filePattern =
/someotherpath/json/jsonlog-%d\{yyyy-MM-dd-HH-mm-ss}.log
I also observed that when I define different rolling frequency, I get flaky
behaviour sometimes it seems that one filePattern value is used across all
appenders but this is possibly another topic with common root cause...
Granted these are edge cases, most likely a user setting different frequency
will have done so because they are only really working with one appender and
the behaviour will be a bit confusing. In real life all file appender will use
same compression and same rolling frequency
was (Author: julienguay):
[[email protected]] Thanks for the question, there is no change if
folders are different...
appender.json_rolling.filePattern =
/someotherpath/json/jsonlog-%d\{yyyy-MM-dd-HH-mm-ss}.log
I also observed that when I define different rolling frequency, I get flaky
behaviour sometimes it seems that one filePattern value is used across all
appenders but this is possibly another topic with common root cause...
> 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)