[
https://issues.apache.org/jira/browse/LOG4J2-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13849033#comment-13849033
]
Andre Bogus commented on LOG4J2-392:
------------------------------------
Hi again,
I finally managed to debug this thing. Interestingly, the logger in my example
is not an org.apache.logging.log4j.core.async.AsyncLogger, as I would have
expected, but a plain org.apache.logging.log4j.core.Logger. Despite my
configuration having not a single synchronous <logger> or <root> entry, the
context isn't even an AsyncLoggerContext. The reason appears to be that in
org.apache.logging.log4j.core.impl.Log4jContextFactory.<init>, in line 44, the
resulting LOG4J_CONTEXT_SELECTOR property (which refers to the
"Log4jContextSelector" system property) is null, therefore the selector will be
instantiated as a ClassLoaderContextSelector, which has absolutely no ties to
the async package.
Now I have two possible recourses:
1. Ask my colleagues to add static { System.setProperty("Log4jContextSelector",
"org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"); } to their
classes
2. Change the ClassLoaderContextSelector to somehow distinguish between
synchronous and asynchronous LoggerContexts.
The first one is only a viable workaround if there are only asynchronous
loggers. I am unsure how to implement the second. Maybe someone more competent
than me in Log4j2 development could have a look? :-)
Regards,
Andre
> Intermittent errors with appenders
> ----------------------------------
>
> Key: LOG4J2-392
> URL: https://issues.apache.org/jira/browse/LOG4J2-392
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.0-beta8, 2.0-beta9
> Environment: Windows 7 SP1 64bit
> Reporter: ilynaf
> Attachments: AppenderOverwhelmer.java, Log4J2.zip, log4j2.xml
>
>
> I intermittently receive following errors after upgrading to beta 8.
> EVERYTHING was working well with beta 6:
> * 1st error (happens most frequently)
> 2013-09-05 10:48:37,722 ERROR Attempted to append to non-started appender
> LogFile
> * 2nd error:
> 2013-09-05 10:49:38,268 ERROR Attempted to append to non-started appender
> LogFile
> 2013-09-05 10:49:38,268 ERROR Unable to write to stream
> log/ui-selenium-tests.log for appender LogFile
> 2013-09-05 10:49:38,269 ERROR An exception occurred processing Appender
> LogFile org.apache.logging.log4j.core.appender.AppenderRuntimeException:
> Error writing to RandomAccessFile log/ui-selenium-tests.log
> at
> org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager.flush(FastRollingFileManager.java:108)
> at
> org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager.write(FastRollingFileManager.java:89)
> 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.FastRollingFileAppender.append(FastRollingFileAppender.java:97)
> at
> org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:102)
> at
> org.apache.logging.log4j.core.appender.AsyncAppender$AsyncThread.run(AsyncAppender.java:228)
> Caused by: java.io.IOException: Write error
> at java.io.RandomAccessFile.writeBytes(Native Method)
> at java.io.RandomAccessFile.write(Unknown Source)
> at
> org.apache.logging.log4j.core.appender.rolling.FastRollingFileManager.flush(FastRollingFileManager.java:105)
> ... 6 more
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]