You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Brendan Miller (JIRA)" <ji...@apache.org> on 2017/02/01 21:42:51 UTC
[jira] [Created] (LOG4J2-1804) Rolling file %i based rolling broken
in 2.8
Brendan Miller created LOG4J2-1804:
--------------------------------------
Summary: 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
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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org