File NOT getting closed in FileAppender
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jaikiran_pai
Posted On:   Monday, January 16, 2006 06:46 AM

Hi, I have a J2EE application in JBoss-3.2.3 which uses log4j for logging. I have configured a Custom appender for my application. This appender is named com.myApp.logger.CustomFileAppender. This extends from org.apache.log4j.FileAppender. I have overriden the append method in this class. In this append method, i create FileAppender with dynamic file names and invoke the append method on these FileAppender. Ex: I create a file name file123_log and create a FileAppender out of the same as follows: dynamicFileAppender = new FileAppender(new PatternLayout("%d - [%c{1}] %m %n"),logFilename,true); I then invoke dynamicFileAppender.append(event) on the same. Everything works fine. T   More>>

Hi,
I have a J2EE application in JBoss-3.2.3 which uses log4j for logging. I have configured a Custom appender for my application. This appender is named com.myApp.logger.CustomFileAppender. This extends from org.apache.log4j.FileAppender. I have overriden the append method in this class.


In this append method, i create FileAppender with dynamic file names and invoke the append method on these FileAppender. Ex: I create a file name file123_log and create a FileAppender out of the same as follows:


dynamicFileAppender = new FileAppender(new PatternLayout("%d - [%c{1}] %m %n"),logFilename,true);


I then invoke dynamicFileAppender.append(event) on the same.
Everything works fine. The log messages get logged.


My problem arises when i try to delete the file123_log file from my browser. I get a windows pop-up message saying "Sharing violation: The source or destination file may be in use".


Does this mean that the close() method is not invoked on the File after logging the log message by log4j?


Is there any way this issue can be fixed?

   <<Less

Re: File NOT getting closed in FileAppender

Posted By:   ankush_purwar  
Posted On:   Monday, January 16, 2006 02:31 PM

This file can't be deleted if log-4j is still running.
Make sure your logging application have been terminated properly.
About | Sitemap | Contact