logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brendan Miller (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LOG4J2-1804) Rolling file %i based rolling broken in 2.8
Date Wed, 01 Feb 2017 21:42:51 GMT
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:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" name="MyApp">
        <RollingFile name="rolling"
            <PatternLayout pattern="%d %5p [%t] (%c) - %m%n"/>
            <SizeBasedTriggeringPolicy size="1MB"/>
            <DefaultRolloverStrategy max="10"/>
        <Root level="INFO">
            <AppenderRef ref="rolling"/>

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) {
    log.info(f"Log statement: $counter%08x ${bytes.mkString}")
    counter += 1

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

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message