[ 
https://issues.apache.org/jira/browse/LOG4J2-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15829160#comment-15829160
 ] 

Jan commented on LOG4J2-1182:
-----------------------------

Thank you for the hint regarding recursion [~rem...@yahoo.com].
I did not find the reason for the closed stream yet. If I have @Startup 
annotated classes which use the same log4j config as the normal application 
classes, the log file is not rolled because it is locked by two separate logger 
instances. This is probably similar with two JVMs.
We only use log viewers which do not block removal, moving or creation of log 
files.



> RandomAccessFile IOException: Stream Closed is back
> ---------------------------------------------------
>
>                 Key: LOG4J2-1182
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1182
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.4.1
>         Environment: Java 1.8.0_60-b27, OSX 10.11, Jackson 2.6.1, Maven 3.3.3
>            Reporter: Ravi Gairola
>            Priority: Minor
>              Labels: Rollover
>
> This error pops up every now and then and looks very similar to LOG4J2-636:
> {code:java}
> 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
> {code}
> Here's the respective yaml configuration:
> {code}
> 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 }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to