"log4j:ERROR Failed to flush writer, java.io.InterruptedIOException" thrown when stopping application
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   J_Diaz
Posted On:   Tuesday, October 21, 2003 03:31 AM

Hi there, I would really appreciate if anyone out there could help me with this problem. Basically I am running a Java server that creates a number of threads and I have setup log4j so that each thread logs to its own file. My log4j.properties file looks like this (1 thread only): ... #-------------------------------------------- # Appender MAIN #-------------------------------------------- log4j.appender.MAIN=org.apache.log4j.RollingFileAppender log4j.appender.MAIN.layout=org.apache.log4j.PatternLayout log4j.appender.MAIN.layout.ConversionPattern=%d %-5p %c %m%n log4j.appender.MAIN.file=${TraceFile}.log log4j.appender.MAIN.ImmediateFlush=true    More>>

Hi there,

I would really appreciate if anyone out there could help me with this problem. Basically I am running a Java server that creates a number of threads and I have setup log4j so that each thread logs to its own file. My log4j.properties file looks like this (1 thread only):

			
...
#--------------------------------------------
# Appender MAIN
#--------------------------------------------
log4j.appender.MAIN=org.apache.log4j.RollingFileAppender
log4j.appender.MAIN.layout=org.apache.log4j.PatternLayout
log4j.appender.MAIN.layout.ConversionPattern=%d %-5p %c %m%n
log4j.appender.MAIN.file=${TraceFile}.log
log4j.appender.MAIN.ImmediateFlush=true

#-------------------------------------------
# Appender TO (used by thread #0)
#-------------------------------------------
log4j.appender.T0=org.apache.log4j.DailyRollingFileAppender
log4j.appender.T0.layout=org.apache.log4j.PatternLayout
log4j.appender.T0.layout.ConversionPattern=%d %-5p %c %m%n
log4j.appender.T0.file=${TraceFile}_thread_0.log
log4j.appender.T0.ImmediateFlush=true


This works perfectly but the following happens when I shut down the server (the code terminates threads first and then the server):

			
log4j:ERROR Failed to flush writer, java.io.InterruptedIOException
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:212)
at java.io.OutputStreamWriter.flushBuffer
(OutputStreamWriter.java:230)
at java.io.OutputStreamWriter.flush
(OutputStreamWriter.java:244)
at org.apache.log4j.helpers.QuietWriter.flush
(QuietWriter.java:49)
at org.apache.log4j.WriterAppender.subAppend
(WriterAppender.java:311)
at org.apache.log4j.DailyRollingFileAppender.subAppend
(DailyRollingFileAppender.java:343)
at org.apache.log4j.WriterAppender.append
(WriterAppender.java:150)
at org.apache.log4j.AppenderSkeleton.doAppend
(AppenderSkeleton.java:222)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
(AppenderAttachableImpl.java:57)
at org.apache.log4j.Category.callAppenders
(Category.java:190)
at org.apache.log4j.Category.forcedLog(Category.java:375)
at org.apache.log4j.Category.debug(Category.java:244)
at java.lang.Thread.run(Thread.java:484)


This does not happen all the time i.e. sometimes I am able to shut down the server without getting any exception at all. Any ideas? Your help would be much appreciated.

Thanks in advance,

J    <<Less
About | Sitemap | Contact