[ https://issues.apache.org/jira/browse/LOG4J2-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13945447#comment-13945447 ]
Bohdan Mushkevych edited comment on LOG4J2-550 at 3/24/14 6:15 PM:
-------------------------------------------------------------------
Ralph
I have tried using double $$ sign, for instance:
{code}
filePattern="${log.path}/$${date:yyyyMMdd}/$${date:yyyyMMddHH}-${sd:type}-${hostName}.%i.log.gz">
{code}
However it only causes exception [1]. Because of this behaviour I have either used single $ or %.
[1] Exception, caused by $${date:yyyyMMdd}
2014-03-24 11:12:22,989 DEBUG Calling createStrategy on class org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy for element DefaultRolloverStrategy with params(max="999", min="null", fileIndex="null", compressionLevel="null", Configuration(RoutingLoggingConfiguration))
2014-03-24 11:12:22,991 ERROR An exception occurred processing Appender Routing java.lang.StringIndexOutOfBoundsException: String index out of range: 95
at java.lang.String.<init>(String.java:201)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:816)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:737)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.replace(StrSubstitutor.java:306)
at org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:792)
at org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:667)
at org.apache.logging.log4j.core.appender.routing.RoutingAppender.createAppender(RoutingAppender.java:153)
at org.apache.logging.log4j.core.appender.routing.RoutingAppender.getControl(RoutingAppender.java:137)
at org.apache.logging.log4j.core.appender.routing.RoutingAppender.append(RoutingAppender.java:111)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:425)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:406)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:367)
at org.apache.logging.log4j.core.Logger.log(Logger.java:112)
at org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLoggerWrapper.java:121)
at org.apache.logging.log4j.EventLogger.logEvent(EventLogger.java:56)
was (Author: mushkevych):
Ralph
I have tried using double $$ sign, for instance:
filePattern="${log.path}/$${date:yyyyMMdd}/$${date:yyyyMMddHH}-${sd:type}-${hostName}.%i.log.gz">
However it only causes exception [1]. Because of this behaviour I have either used single $ or %.
[1] Exception, caused by $${date:yyyyMMdd}
2014-03-24 11:12:22,989 DEBUG Calling createStrategy on class org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy for element DefaultRolloverStrategy with params(max="999", min="null", fileIndex="null", compressionLevel="null", Configuration(RoutingLoggingConfiguration))
2014-03-24 11:12:22,991 ERROR An exception occurred processing Appender Routing java.lang.StringIndexOutOfBoundsException: String index out of range: 95
at java.lang.String.<init>(String.java:201)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:816)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:737)
at org.apache.logging.log4j.core.lookup.StrSubstitutor.replace(StrSubstitutor.java:306)
at org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:792)
at org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:667)
at org.apache.logging.log4j.core.appender.routing.RoutingAppender.createAppender(RoutingAppender.java:153)
at org.apache.logging.log4j.core.appender.routing.RoutingAppender.getControl(RoutingAppender.java:137)
at org.apache.logging.log4j.core.appender.routing.RoutingAppender.append(RoutingAppender.java:111)
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:425)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:406)
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:367)
at org.apache.logging.log4j.core.Logger.log(Logger.java:112)
at org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLoggerWrapper.java:121)
at org.apache.logging.log4j.EventLogger.logEvent(EventLogger.java:56)
Post by Bohdan Mushkevych (JIRA).log files are left un-archived after JVM restart
-------------------------------------------------
Key: LOG4J2-550
URL: https://issues.apache.org/jira/browse/LOG4J2-550
Project: Log4j 2
Issue Type: Bug
Components: Core
Affects Versions: 2.0-rc1
Reporter: Bohdan Mushkevych
Attachments: log4j2.xml
I am using log4j 2.0-rc1, StructuredDataMessage and EventLogger to perform dynamic logging.
- rotate log files on hourly basis OR after file reaches 64 MB (whatever comes first)
- archive logs that does not satisfy the file pattern
-rw-r--r--. 1 root root 317625 Feb 24 20:16 2014022419-sim-mdmlocal.mobidia.com.log
-rw-r--r--. 1 root root 3333648 Feb 24 20:20 2014022420-activity-mdmlocal.mobidia.com.log
Listing above shows that file 2014022419-sim-mdmlocal.mobidia.com.log was last touched by the system at 20:16, and should have been archived to .log.gz after restart, which occurred soon after
--
This message was sent by Atlassian JIRA
(v6.2#6252)