[
https://issues.apache.org/jira/browse/LOG4J2-1767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
prayagupd updated LOG4J2-1767:
--
Description:
I have log4j2.json config as below, with SizeBasedTriggeringPolicy as 1MB. Its
a web app hosted on tomcat 7.
{code}
{
"configuration": {
"status" : "info",
"shutdownHook":"disable",
"name": "lo",
"appenders": {
"RollingFile": {
"name": "rollingFile",
"fileName": "/var/log/cor/test_logging12.log",
"filePattern":
"/var/log/cor/test_logging12-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz",
"CustomJSONLayout": {
"complete": false,
"compact": true,
"eventEol": true
},
"SizeBasedTriggeringPolicy": {
"size": "1 MB"
},
"DefaultRolloverStrategy": {
"max": "10"
}
}
},
"loggers": {
"root": {
"level": "DEBUG",
"appender-ref": {
"ref": "rollingFile"
}
}
}
}
}
{code}
When I changed that in on the fly, it is taken in account by log4j2, it still
rolls over on the older size. It reads the new size only if I restart the
server.
{code}
2017-01-05 12:44:22,143 http-bio-8989-exec-10 TRACE
DefaultRolloverStrategy.purge() took 0.0 milliseconds
2017-01-05 12:44:22,144 http-bio-8989-exec-10 DEBUG RollingFileManager
executing synchronous FileRenameAction[/var/log/cor/logging12.log to
/var/log/cor/logging12-01-05-17-12-44-22-1.log, renameEmptyFiles=false]
2017-01-05 12:44:22,144 http-bio-8989-exec-10 DEBUG RollingFileManager
executing async GzCompressAction[/var/log/cor/logging12-01-05-17-12-44-22-1.log
to /var/log/cor/logging12-01-05-17-12-44-22-1.log.gz, deleteSource=true]
{code}
It would be great if the new size is read by the log4j2 before rolling over
just like the fileName or filePattern.
was:
I have log4j2.json config as below, with SizeBasedTriggeringPolicy as 1MB. Its
a web app hosted on tomcat 7.
{code}
{
"configuration": {
"status" : "info",
"shutdownHook":"disable",
"name": "lo",
"appenders": {
"RollingFile": {
"name": "rollingFile",
"fileName": "/var/log/cor/test_logging12.log",
"filePattern":
"/var/log/cor/test_logging12-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz",
"CustomJSONLayout": {
"complete": false,
"compact": true,
"eventEol": true
},
"SizeBasedTriggeringPolicy": {
"size": "1 MB"
},
"DefaultRolloverStrategy": {
"max": "10"
}
}
},
"loggers": {
"root": {
"level": "DEBUG",
"appender-ref": {
"ref": "rollingFile"
}
}
}
}
}
{code}
When I changed that in on the fly, it is taken in account by log4j2, it still
rolls over on the older size. It reads the new size only if I restart the
server.
{code}
2017-01-05 12:44:22,143 http-bio-8989-exec-10 TRACE
DefaultRolloverStrategy.purge() took 0.0 milliseconds
2017-01-05 12:44:22,144 http-bio-8989-exec-10 DEBUG RollingFileManager
executing synchronous FileRenameAction[/var/log/cor/logging12.log to
/var/log/cor/logging12-01-05-17-12-44-22-1.log, renameEmptyFiles=false]
2017-01-05 12:44:22,144 http-bio-8989-exec-10 DEBUG RollingFileManager
executing async GzCompressAction[/var/log/cor/logging12-01-05-17-12-44-22-1.log
to /var/log/cor/logging12-01-05-17-12-44-22-1.log.gz, deleteSource=true]
{code}
> when SizeBasedTriggeringPolicy value is changed on the fly, log4j2 still
> picks up the older value
> -
>
> Key: LOG4J2-1767
> URL: https://issues.apache.org/jira/browse/LOG4J2-1767
> Project: Log4j 2
> Issue Type: Question
> Components: Appenders
>Affects Versions: 2.5
> Environment: java-1.8.0-ibm-1.8.0.3.20-1,
> log4j2 2.5
>Reporter: prayagupd
>
> I have log4j2.json config as below, with SizeBasedTriggeringPolicy as 1MB.
> Its a web app hosted on tomcat 7.
> {code}
> {
> "configuration": {
> "status" : "info",
> "shutdownHook":"disable",
> "name": "lo",
> "appenders": {
> "RollingFile": {
> "name": "rollingFile",
> "fileName": "/var/log/cor/test_logging12.log",
> "filePattern":
> "/var/log/cor/test_logging12-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz",
> "CustomJSONLayout": {
> "complete": false,
> "compact": true,
> "eventEol": true
> },
> "SizeBasedTriggeringPolicy": {
> "size": "1 MB"
> },
> "DefaultRolloverStrategy": {
> "max": "10"
> }
> }
> },
> "loggers": {
> "root": {
> "level": "DEBUG",
> "appender-ref": {
> "ref": "rollingFile"
> }
> }
> }
> }
> }
>