[ https://issues.apache.org/jira/browse/LOG4J2-2282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16401393#comment-16401393 ]
Remko Popma commented on LOG4J2-2282: ------------------------------------- At first glance your configuration looks correct. Is it possible that there are multiple versions (including an older version) of Log4j 2 on the classpath? Can you try starting your application with system property {{-Dlog4j2.debug}}? That should display TRACE-level [internal Log4j logging|https://logging.apache.org/log4j/2.x/faq.html#troubleshooting] to the console. Please include that output in the description of this ticket. > How i delete the old log files with 2.10.0 > ------------------------------------------ > > Key: LOG4J2-2282 > URL: https://issues.apache.org/jira/browse/LOG4J2-2282 > Project: Log4j 2 > Issue Type: Question > Components: Core > Affects Versions: 2.10.0 > Reporter: Rehel > Priority: Major > > Hi i tried to deleted my old log files but I have not been successful. > Here is my xml file. > {code:java} > <Configuration status="error" name="rhl" packages=""> > <Appenders> > <Console name="STDOUT" target="SYSTEM_OUT"> > <PatternLayout pattern="%m%n"/> > </Console> > <RollingFile name="RollingFile" fileName="logs/test.log" > filePattern="logs/test-%d{dd-MM-yy hh-mm}-%i.log.gz"> > <PatternLayout> > <Pattern>%d %p %c{1.} [%t] %m%n</Pattern> > </PatternLayout> > <Policies> > <TimeBasedTriggeringPolicy interval="1" modulate="true"/> > <SizeBasedTriggeringPolicy size="50MB"/> > </Policies> > <DefaultRolloverStrategy max="5"> > <Delete basePath="logs/" maxDepth="2"> > <IfFileName glob="*/test-*.log.gz" /> > <IfLastModified age="7d" /> > </Delete> > </DefaultRolloverStrategy> > </RollingFile> > </Appenders> > <Loggers> > <Root level="error"> > <AppenderRef ref="RollingFile" /> > <AppenderRef ref="STDOUT"/> > </Root> > </Loggers> > </Configuration>{code} > > and here is the console output; > {code:java} > 2018-03-16 01:04:25,154 main ERROR Delete contains invalid attributes > "IfFileName", "IfLastModified" > 2018-03-16 01:04:25,156 main ERROR Missing Delete conditions: unconditional > Delete not supported > 2018-03-16 01:04:25,158 main ERROR Unable to invoke factory method in class > org.apache.logging.log4j.core.appender.rolling.action.DeleteAction for > element Delete: java.lang.IllegalArgumentException: Unconditional Delete not > supported java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:958) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:898) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:513) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:237) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:249) > at > org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) > at > org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) > at > org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) > at > org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) > at > org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153) > at > org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) > at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) > at > org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) > at > org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43) > at > org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) > at > org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) > at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) > at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) > at excuseme.Main.<clinit>(Main.java:22) > Caused by: java.lang.IllegalArgumentException: Unconditional Delete not > supported > at > org.apache.logging.log4j.core.appender.rolling.action.DeleteAction.<init>(DeleteAction.java:71) > at > org.apache.logging.log4j.core.appender.rolling.action.DeleteAction.createDeleteAction(DeleteAction.java:212) > ... 27 more > 2018-03-16 01:04:25,161 main ERROR Null object returned for Delete in > DefaultRolloverStrategy. > {code} > What should i do? -- This message was sent by Atlassian JIRA (v7.6.3#76005)