[ https://issues.apache.org/jira/browse/LOG4J2-1804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15897924#comment-15897924 ]
Brendan Miller commented on LOG4J2-1804: ---------------------------------------- Looks to work for me in 2.8.1. Thanks. > Rolling file %i based rolling broken in 2.8 > ------------------------------------------- > > Key: LOG4J2-1804 > URL: https://issues.apache.org/jira/browse/LOG4J2-1804 > Project: Log4j 2 > Issue Type: Bug > Components: Appenders > Affects Versions: 2.8 > Reporter: Brendan Miller > Assignee: Ralph Goers > Fix For: 2.8.1 > > Attachments: LOG4J2-1804.junit.and.fix.patch, LOG4J2-1804.junit.patch > > > Log files do not seem to be rolling up to the max number of files as > specified in DefaultRolloverStrategy while utilizing a > SizeBasedTriggeringPolicy. It is just rolling just to 1 file. > Simple repro: > log4j2.xml > {code} > <?xml version="1.0" encoding="UTF-8"?> > <Configuration status="INFO" name="MyApp"> > <Appenders> > <RollingFile name="rolling" > fileName="__logs__/rolling.log" > filePattern="__logs__/rolling.log.%i" > immediateFlush="true"> > <PatternLayout pattern="%d %5p [%t] (%c) - %m%n"/> > <SizeBasedTriggeringPolicy size="1MB"/> > <DefaultRolloverStrategy max="10"/> > </RollingFile> > </Appenders> > <Loggers> > <Root level="INFO"> > <AppenderRef ref="rolling"/> > </Root> > </Loggers> > </Configuration> > {code} > MyApp.scala: > {code} > import scala.util.Random > import org.apache.logging.log4j.LogManager > object MyApp extends App { > val log = LogManager.getLogger(this.getClass) > var counter = 0L > var bytes = new Array[Byte](1000) > while (true) { > Random.nextBytes(bytes) > log.info(f"Log statement: $counter%08x ${bytes.mkString}") > counter += 1 > Thread.sleep(5) > } > } > {code} > If you run that against 2.7, things roll fine. If you run that against 2.8, > you'll only see rolling.log & rolling.log.1 in the __logs__ folder. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org