Log4j writing in different logfiles
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   fabs_heinz
Posted On:   Thursday, September 6, 2007 03:41 AM

Hi, I want to force Log4j to write to different logfiles without configuring it in the properties file, because they are already very long and in this project there are lot of other ini and config files in this project. I just want Log4j to write seperate logging files for each thread, so I wrote an own Appender, which maps a RollingFileAppender to a file named like the Logger which logs the event. There is a Hashmap to save them... But my problem is, I get following error: log4j:ERROR Could not close org.apache.log4j.helpers.CountingQuietWriter@4ac9131c java.io.IOException: Bad file number at java.io.FileOutputStream.writeBytes(Native Method)    More>>

Hi,


I want to force Log4j to write to different logfiles without configuring it in the properties file, because they are already very long and in this project there are lot of other ini and config files in this project.

I just want Log4j to write seperate logging files for each thread, so I wrote an own Appender, which maps a RollingFileAppender to a file named like the Logger which logs the event. There is a Hashmap to save them...


But my problem is, I get following error:


log4j:ERROR Could not close
org.apache.log4j.helpers.CountingQuietWriter@4ac9131c


java.io.IOException: Bad file number


at java.io.FileOutputStream.writeBytes(Native Method)


at java.io.FileOutputStream.write(FileOutputStream.java:260)


at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)


at sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:427)


at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)


at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)


at java.io.FilterWriter.close(FilterWriter.java:92)


at org.apache.log4j.FileAppender.closeFile(FileAppender.java:183)


at org.apache.log4j.FileAppender.reset(FileAppender.java:338)


at org.apache.log4j.WriterAppender.close(WriterAppender.java:204)


at org.apache.log4j.AppenderSkeleton.finalize(AppenderSkeleton.java:124)


at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)


at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)


at java.lang.ref.Finalizer.access$100(Finalizer.java:14)

at
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)




I searched the net, also the docu you have to pay for but didn't find the solution.



Has someone an idea or maybe a better way to reach my aim




thanks for help



greetings



fabs

   <<Less
About | Sitemap | Contact