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

Ralph Goers commented on LOG4J2-1798:
-------------------------------------

Thanks for the explanation.  I am not sure how causing threads to be 
interrupted maximizes performance but it doesn't really matter. The fact that 
it is part of the design of the application means that Log4j needs to deal with 
it.  The issue I am having though is that if Log4j detects the 
InterruptedException and then just ignores it and retries I would think that 
would conflict with what the thing causing the interrupts was trying to do.  
But that seems like the only sane approach.

> InterruptedException on RollingFileManager#rollover()
> -----------------------------------------------------
>
>                 Key: LOG4J2-1798
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1798
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.7
>         Environment: Java JDK 1.8 Update 73,
> on Windows Server 2008 R2 Standard Service Pack 1
>            Reporter: Danilo Härtzer
>            Assignee: Ralph Goers
>            Priority: Minor
>         Attachments: LOG4J2-1798.patch
>
>
> We configured RollingFile-Appenders in the following way (3 different log 
> files for the same log output but with different log levels, rolling each 
> hour):
> {code}
> property.patternLayout=%d [%-5level] [%t] %X %c{1.} - %m%ex%n
> # Bildungsvorschriften für Logdateien
> property.fileNamePrefix=./log/current-
> property.fileNameSuffix=.log
> property.filePatternPrefix=./log/%d{yyyy_MM_dd_HH}-
> property.filePatternSuffix=.log
> # Appenders
> ###########
> appenders=all, info, error
> appender.all.type=RollingFile
> appender.all.name=all
> appender.all.fileName=${fileNamePrefix}all${fileNameSuffix}
> appender.all.filePattern=${filePatternPrefix}all${filePatternSuffix}
> appender.all.layout.type=PatternLayout
> appender.all.layout.pattern=${patternLayout}
> appender.all.policies.type=Policies
> appender.all.policies.time.type=TimeBasedTriggeringPolicy
> appender.info.type=RollingFile
> appender.info.name=info
> appender.info.fileName=${fileNamePrefix}info${fileNameSuffix}
> appender.info.filePattern=${filePatternPrefix}info${filePatternSuffix}
> appender.info.layout.type=PatternLayout
> appender.info.layout.pattern=${patternLayout}
> appender.info.policies.type=Policies
> appender.info.policies.time.type=TimeBasedTriggeringPolicy
> appender.error.type=RollingFile
> appender.error.name=error
> appender.error.fileName=${fileNamePrefix}error${fileNameSuffix}
> appender.error.filePattern=${filePatternPrefix}error${filePatternSuffix}
> appender.error.layout.type=PatternLayout
> appender.error.layout.pattern=${patternLayout}
> appender.error.policies.type=Policies
> appender.error.policies.time.type=TimeBasedTriggeringPolicy
> {code}
> Sometimes for a certain log file the rollover does not work, throwing this 
> exception cause:
> {code}
> 2017-01-22 17:06:23,942 Con1 ERROR RollingFileManager ./log/current-error.log 
> Thread interrupted while attempting to check rollover: 
> java.lang.InterruptedException java.lang.InterruptedException
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1302)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> java.util.concurrent.Semaphore.acquire(Semaphore.java:312)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:247)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:192)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.appender.rolling.RollingFileManager.checkRollover(RollingFileManager.java:175)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.appender.RollingFileAppender.append(RollingFileAppender.java:280)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:447)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:432)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:416)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:402)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2091)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1971)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1829)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> org.apache.logging.log4j.jcl.Log4jLog.error(Log4jLog.java:116)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> net.wimpi.telnetd.io.TelnetIO.closeOutput(TelnetIO.java:321)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> net.wimpi.telnetd.io.TerminalIO.close(TerminalIO.java:769)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> net.wimpi.telnetd.net.Connection.close(Connection.java:220)
> INFO   | jvm 1    | 2017/01/22 17:06:23 |     at 
> net.wimpi.telnetd.net.Connection.run(Connection.java:143)
> {code}
> If this happens, it happens again and again on every Rollover-action (if the 
> next hour has been passed and the rollover action is starting again).
> After this failure Log4J2 is still logging to the 'old' log file (in this 
> case: ./log/current-error.log).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to