Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-799

Log4j 2 throws ArrayIndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.0-rc1, 2.0-rc2, 2.0.2
    • 2.1
    • None
    • None

    Description

      Sometimes, logging throws java.lang.ArrayIndexOutOfBoundsException:

      2014-05-23 01:01:37,019 ERROR An exception occurred processing Appender Err java.lang.ArrayIndexOutOfBoundsException: 6
              at org.apache.logging.log4j.core.impl.ThrowableProxy.formatElements(ThrowableProxy.java:269)
              at org.apache.logging.log4j.core.impl.ThrowableProxy.getExtendedStackTrace(ThrowableProxy.java:232)
              at org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter.format(ExtendedThrowablePatternConverter.java:72)
              at org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:36)
              at org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:172)
              at org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:52)
              at org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:45)
              at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:118)
              at org.apache.logging.log4j.core.appender.RollingFileAppender.append(RollingFileAppender.java:85)
              at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
              at org.apache.logging.log4j.core.appender.AsyncAppender$AsyncThread.callAppenders(AsyncAppender.java:276)
              at org.apache.logging.log4j.core.appender.AsyncAppender$AsyncThread.run(AsyncAppender.java:239)
      

      Here is configuration:

      <Configuration status="warn">
      
      <Appenders>
          <Async name="Async" bufferSize="2048" blocking="${BLOCKING_LOG}">
              <appender-ref ref="A1"/>
              <appender-ref ref="Err"/>
          </Async>
      
          <Async name="Async-profiler" bufferSize="2048" blocking="${BLOCKING_LOG}">
              <appender-ref ref="Profiler"/>
          </Async>
      
          <RollingFile name="A1" fileName="${GFT_VAR}/log/${target}.log" filePattern="${GFT_VAR}/log/${target}.log.%i">
              <PatternLayout pattern="[%d] [%t] %-5p %c - %m%n"/>
              <DefaultRolloverStrategy max="3"/>
              <Policies>
                  <SizeBasedTriggeringPolicy size="50Mb"/>
              </Policies>
          </RollingFile>
      
          <RollingFile name="Err" fileName="${GFT_VAR}/log/${target}.err" filePattern="${GFT_VAR}/log/${target}.err.%i">
              <ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
              <PatternLayout pattern="[%d] [%t] %-5p %c - %m%n"/>
              <DefaultRolloverStrategy max="2"/>
              <Policies>
                  <SizeBasedTriggeringPolicy size="10MB"/>
              </Policies>
          </RollingFile>
      
          <RollingFile name="Profiler" fileName="${GFT_VAR}/log/${target}.stat"
                       filePattern="${GFT_VAR}/log/${target}.stat.%i">
              <PatternLayout pattern="[%d] [%t] %-5p %c - %m%n"/>
              <DefaultRolloverStrategy max="3"/>
              <Policies>
                  <SizeBasedTriggeringPolicy size="10MB"/>
              </Policies>
          </RollingFile>
      
      </Appenders>
      
      <Loggers>
          <Root level="debug">
              <AppenderRef ref="Async"/>
          </Root>
      
          <Logger name="net.sf" level="info">
              <AppenderRef ref="Async"/>
          </Logger>
      
          <Logger name="org.springframework.jdbc.core.JdbcTemplate" level="info">
              <AppenderRef ref="Async"/>
          </Logger>
      
          <Logger name="gft.service.stats.PoolableMetrics" additivity="false" level="info">
              <AppenderRef ref="Async"/>
          </Logger>
      
          <Logger name="gft.util.profiling.Profiler" additivity="false">
              <AppenderRef ref="Async-profiler"/>
          </Logger>
      
      </Loggers>
      
      </Configuration>
      

      Attachments

        1. Log4j2_799Test.java
          2 kB
          Gökalp Kuşçu
        2. log4j2-799.xml
          2 kB
          Gökalp Kuşçu
        3. Log4j-799.diff
          5 kB
          Gary D. Gregory
        4. result.zip
          0.8 kB
          Gökalp Kuşçu

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ndkoval Nikita Koval
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: