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

FastFileAppender and FastRollingFileAppender not thread-safe

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0-beta8
    • 2.0-beta9
    • Appenders, Core
    • None

    Description

      FastFileManager#flush method needs to be synchronized.

      I'm seeing the exception below. This can only happen if two threads modify the ByteBuffer simultaneously.

      2013-07-17 19:00:29,033 ERROR An exception occurred processing Appender LatencyFile java.lang.IllegalArgumentException
      	at java.nio.Buffer.position(Buffer.java:236)
      	at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:185)
      	at org.apache.logging.log4j.core.appender.FastFileManager.write(FastFileManager.java:96)
      	at org.apache.logging.log4j.core.appender.OutputStreamManager.write(OutputStreamManager.java:129)
      	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:115)
      	at org.apache.logging.log4j.core.appender.FastFileAppender.append(FastFileAppender.java:87)
      	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:102)
      	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:426)
      	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:407)
      	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:368)
      	at org.apache.logging.log4j.core.Logger.log(Logger.java:110)
      	at org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1011)
      	at ...
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rpopma Remko Popma
            rpopma Remko Popma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment