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

RandomAccessFile IOException: Stream Closed is back

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.4.1
    • Fix Version/s: None
    • Component/s: Appenders
    • Labels:
    • Environment:

      Java 1.8.0_60-b27, OSX 10.11, Jackson 2.6.1, Maven 3.3.3

      Description

      This error pops up every now and then and looks very similar to LOG4J2-636:

      2015-10-27-23:00:00 2015-10-27 16:00:00,038 scribe-EventScribe ERROR Unable to write to stream logs/server.log for appender AppLog
      2015-10-27-23:00:00 2015-10-27 16:00:00,038 scribe-EventScribe ERROR An exception occurred processing Appender AppLog org.apache.logging.log4j.core.appender.AppenderLoggingException: Error writing to RandomAccessFile logs/server.log
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager.flush(RollingRandomAccessFileManager.java:132)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager.write(RollingRandomAccessFileManager.java:112)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.appender.OutputStreamManager.write(OutputStreamManager.java:136)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:105)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender.append(RollingRandomAccessFileAppender.java:98)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:152)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:125)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:116)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:390)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:378)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:362)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.LoggerConfig.logParent(LoggerConfig.java:384)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:379)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:362)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:352)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:143)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1011)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:988)
      2015-10-27-23:00:00 	at org.apache.logging.slf4j.Log4jLogger.error(Log4jLogger.java:318)
      2015-10-27-23:00:00 	at com.nextbit.syncserver.common.EventScribe$Scribe.run(EventScribe.java:142)
      2015-10-27-23:00:00 Caused by: java.io.IOException: Stream Closed
      2015-10-27-23:00:00 	at java.io.RandomAccessFile.writeBytes(Native Method)
      2015-10-27-23:00:00 	at java.io.RandomAccessFile.write(RandomAccessFile.java:525)
      2015-10-27-23:00:00 	at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager.flush(RollingRandomAccessFileManager.java:129)
      2015-10-27-23:00:00 	... 21 more
      

      Here's the respective yaml configuration:

      configuration:
        monitorInterval: 60
        status: WARN
        name: Production Configuration
        packages: com.our.packages
        appenders:
          appender:
            -
              type: Console
              name: CONSOLE
              PatternLayout: { pattern: '%d{yyyy-MMM-dd-HH:mm:ss.SSS} [%p|%c{1}|%t|%X{rid}] %h: %m %n' }
            -
              type: RollingRandomAccessFile
              name: AppLog
              fileName: logs/server.log
              filePattern: 'logs/server.log.%d{yyyy-MM-dd-HH}.gz'
              append: true
              PatternLayout: { pattern: '%d{yyyy-MMM-dd-HH:mm:ss.SSS} [%p|%c{1}|%t|%X{rid}] %h: %m %n' }
              TimeBasedTriggeringPolicy: { modulate: true }
              DefaultRolloverStrategy: { max: 240 }
        loggers:
            - { name: com.amazonaws, level: warn }
            - { name: org.hibernate, level: warn }
          root:
            level: info
            AppenderRef: { ref: AppLog }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mallox Ravi Gairola
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: