As far as I know if I use an editor to open a log file then that should not lock it for the application... As I mentioned, even though the file is on a shared NFS, no other application is accessing/writing to the same log4j file. I have the habit of creating separate directory for each web application. A tomcat hosting another application running on another server also uses log4j and writes to the shared NFS but to a different directory structure.
The application is multi-threaded so it is possible that multiple threads are writing to the same log4j file - but since log4j is multi-threaded that should not be an issue. Any further thoughts or workarounds? Thank you, Menon ----------------------------------------------------------- R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC Programming, http://www.amazon.com/exec/obidos/tg/detail/-/159059407X/ ----------------------------------------------------------- On Fri, Apr 24, 2009 at 8:59 AM, Matt Brown <[email protected]>wrote: > I'm not really up on the internals of RollingFileAppender, but I would bet > that the file residing on a shared NFS directory is in fact the cause of the > problem. This log message (which is just logged at INFO, and isn't truly an > exception being thrown outside of log4j) is indicating that log4j could not > close the file, which I believe it is necessary to do to rename it. > > I'd assume the file could not be closed / renamed because someone was > accessing it on the shared location and possibly even had it locked. > > -----Original Message----- > From: ramakrishna menon [mailto:[email protected]] > Sent: Friday, April 24, 2009 11:26 AM > To: Log4J Users List > Subject: Re: Log4j exception Could not close > org.apache.log4j.helpers.CountingQuietWriter > > Sure - thank you for a super prompt response! Here is my log4j > configuration. The directory in which the application writes is a shared NFS > directory if it makes any difference. But no other vm (tomcat) or > application is writing to this directory... > # log4j properties file > #log4j.debug=true > log4j.rootLogger=WARN, R > # > log4j.appender.R=org.apache.log4j.RollingFileAppender > log4j.appender.R.File=/data/etl/ssm/extractor/logs/extractor.log > log4j.appender.R.MaxFileSize=20MB > log4j.appender.R.MaxBackupIndex=30 > log4j.appender.R.layout=org.apache.log4j.PatternLayout > log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n # > log4j.logger.com.opinmind=DEBUG > log4j.logger.org.apache.commons.digester=debug > > > ----------------------------------------------------------- > R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC > Programming, http://www.amazon.com/exec/obidos/tg/detail/-/159059407X/ > ----------------------------------------------------------- > > > On Fri, Apr 24, 2009 at 8:10 AM, Matt Brown <[email protected] > >wrote: > > > Can you share your log4j configuration? > > > > -----Original Message----- > > From: ramakrishna menon [mailto:[email protected]] > > Sent: Friday, April 24, 2009 11:08 AM > > To: [email protected] > > Subject: Log4j exception Could not close > > org.apache.log4j.helpers.CountingQuietWriter > > > > Hi I have a web application installed on a single tomcat instance. > > > > After around 2 to 5 days of running, the entire application stalls. > > When checking the log, I get the following error stack. I did some > > research on this on google but could not find any solution. What can I > > do to avoid this situation? A tomcat bounce typically resolves the > situation temporarily. > > > > Thank you! > > Menon > > Apr 23, 2009 11:40:40 PM org.apache.catalina.core.StandardWrapperValve > > invoke > > INFO: log4j:ERROR Could not close > > org.apache.log4j.helpers.countingquietwri...@11361f82 > > java.io.IOException: Input/output error > > at java.io.FileOutputStream.close0(Native Method) > > at java.io.FileOutputStream.close(FileOutputStream.java:279) > > at > > sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:431) > > 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.RollingFileAppender.rollOver(RollingFileAppender.java:146) > > at > > > > > org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:239) > > at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) > > at > > org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) > > at > > > > > org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) > > at org.apache.log4j.Category.callAppenders(Category.java:203) > > at org.apache.log4j.Category.forcedLog(Category.java:388) > > at org.apache.log4j.Category.debug(Category.java:257) > > at > > com.opinmind.db.DbUtil.executeDbProcAffectingRows(DbUtil.java:244) > > at > > > > > com.opinmind.webapp.exporter.AbstractExporter.logExtractorStats(AbstractExporter.java:139) > > at > > > > > com.opinmind.webapp.exporter.ExporterAssumingClientOnDbImpl.generateFile(ExporterAssumingClientOnDbImpl.java:138) > > at > > > > > com.opinmind.webapp.etl.extractor.DbDataExporter.getFiles(DbDataExporter.java:65) > > at > > > > > com.opinmind.webapp.etl.extractor.action.ExtractDbDataIntoFileAction.doExecute(ExtractDbDataIntoFileAction.java:71) > > at > com.opinmind.webapp.action.BaseAction.execute(BaseAction.java:50) > > at > > > > > org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58) > > at > > > > > org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67) > > at > > > > > org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) > > at > > org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) > > > > ----------------------------------------------------------- > > R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC > > Programming, http://www.amazon.com/exec/obidos/tg/detail/-/159059407X/ > > ----------------------------------------------------------- > > ----------------------------------------------------------- > > R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC > > Programming, http://www.amazon.com/exec/obidos/tg/detail/-/159059407X/ > > ----------------------------------------------------------- > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
