You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Gitit Amihud <gi...@yahoo.com> on 2005/07/05 08:27:31 UTC
RE: RollingFileAppender stop write to log files
Hi Nicko
I get the following exception:
g4net:ERROR [RollingFileAppender] Exception while rolling file [D:\NICECTI\log\RCM.log.25] -> [D:\NICECTI\log\RCM.log.26]
stem.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.__Error.WinIOError()
at System.IO.FileInfo.MoveTo(String destFileName)
at log4net.Appender.RollingFileAppender.RollFile(String fromFile, String toFile)
(its not so clear since I took it from the screen.)
the outcome is that new file is not open.
but in the log4net source I saw that there is call for :
this.OpenFile(m_baseFileName, false) in RollOverSize() but again its not open and we dont get logs for days till someone looking for them and dont find.
thanks for your help
Nicko Cadell <ni...@neoworks.com> wrote:
If you enable internal logging you should see any exceptions that are
generated by the appender:
http://logging.apache.org/log4net/release/manual/faq.html#internalDebug
Nicko
> -----Original Message-----
> From: Gitit Amihud [mailto:gitit_amihud@yahoo.com]
> Sent: 26 June 2005 11:54
> To: log4net-user@logging.apache.org
> Subject: RollingFileAppender stop write to log files
>
> Hi
>
> we use the log4net version 1.2.0.30714 below is part of the
> code that configure the log4net (we dont use the config
> file).I use .net 1.1,my process are multi threaded
>
> it somtimes just stop writing to the log file. it happens
> when the file ended and it need to open new file. (I juess it
> dont succeed opening the new file)
>
> after starting my program again it write to the file as
> needed(via log4net)
>
> can you help me?!
>
> thanks
>
> rollingFileAppender = new RollingFileAppender();
>
> rollingFileAppender.Name = "RollingFileAppender";
>
> rollingFileAppender.Threshold = log4net.spi.Level.ALL;
> /////dynamic/////
>
> rollingFileAppender.File = (m_bLimitedMode ? "" :
> m_strLogFilesPath) + m_strProcessName + "." + m_strLogFilesExt;
>
> rollingFileAppender.AppendToFile = true;
>
> rollingFileAppender.MaximumFileSize =50000 "MB";
>
> rollingFileAppender.MaxSizeRollBackups = 60;
>
> rollingFileAppender.RollingStyle =
> RollingFileAppender.RollingMode.Size;
>
> rollingFileAppender.StaticLogFileName = false;
>
> rollingFileAppender.DatePattern = "yyyy-MM-dd HH.mm";
>
> rollingFileAppender.Layout = new
> log4net.Layout.PatternLayout(FILE_PATTERN_LAYOUT);
>
> logger.AddAppender(rollingFileAppender);
>
> rollingFileAppender.ActivateOptions();
>
> ________________________________
>
> Yahoo! Sports
> Rekindle the Rivalries. Sign up for Fantasy Football
> > /football.fantasysports.yahoo.com?ovchn=YAH&ovcpn=Integration&
> ovcrn=Mail+footer&ovrfd=YAH&ovtac=AD>
>
---------------------------------
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
Re: RollingFileAppender stop write to log files
Posted by Sebastian Andersson <sa...@hogia.net>.
On Mon, Jul 04, 2005 at 11:27:31PM -0700, Gitit Amihud wrote:
> I get the following exception:
> g4net:ERROR [RollingFileAppender] Exception while rolling file [D:\NICECTI\log\RCM.log.25] -> [D:\NICECTI\log\RCM.log.26]
> stem.IO.IOException: The process cannot access the file because it is being used by another process.
With Windows 2000 AS and VB6 I had a problem with rename when I
implemented a rolling file appender for a program. The old filename
was sometimes(!) locked by the OS for a while after a rename and it
was impossible to create a new file with the old-name until after
a short while (since the system wasn't time critical, I tried it again
in a loop).
Perhaps newer versions of windows keep that feature?
/Sebastian