This is a bug in the RollingFileAppender not respecting the MaxSizeRollBackups when CountDirection is 1. This will be addressed in the next release or you can build a custom release from Apache CVS. In the current release if you need the MaxSizeRollBackups functionality you will have to use CountDirection -1 and live with the locking issues around rolling files.
I have created an issue to track this: http://issues.apache.org/jira/browse/LOG4NET-40 Cheers, Nicko > -----Original Message----- > From: Gitit Amihud [mailto:[EMAIL PROTECTED] > Sent: 06 July 2005 09:30 > To: Log4NET User > Subject: RE: RollingFileAppender stop write to log files > > Hi Nicko! > I made both changes you suggested(moved to 1.2.9 and set the > CountDirection property to 1) but now I have another problem: > log4net ignores the maxSizeRollBackups property: > > log4net: FileAppender: Opening file for writing > [c:\nicecti\log\RCM.log.10] append [False] > log4net: RollingFileAppender: rolling over count [4194345] > log4net: RollingFileAppender: maxSizeRollBackups [3] > log4net: RollingFileAppender: curSizeRollBackups [10] > log4net: RollingFileAppender: countDirection [1] > log4net: FileAppender: Opening file for writing > [c:\nicecti\log\RCM.log.11] append [False] > log4net: RollingFileAppender: rolling over count [4194345] > log4net: RollingFileAppender: maxSizeRollBackups [3] > log4net: RollingFileAppender: curSizeRollBackups [11] > log4net: RollingFileAppender: countDirection [1] > > and so on. > what should I do? thanks for all your help > > Nicko Cadell <[EMAIL PROTECTED]> wrote: > > As indicated in the error message some process on the > system has the > target file locked and the archive file cannot be rolled. > A possible solution is to set the CountDirection > property to 1 on the > RollingFileAppender, this will change the appender to > name the most > recent rolled file with the highest number, therefore > it will not be > necessary to roll all the archive files each time a new file is > archived. > > The rolling logic of the RollingFileAppender has been > made more robust > in the 1.2.9 version of log4net so that an error > rolling an archive file > will not stop the appender logging anything. Therefore > this may be > resolved by upgrading: > http://logging.apache.org/log4net/downloads.html > > Cheers, > Nicko > > > -----Original Message----- > > From: Gitit Amihud [mailto:[EMAIL PROTECTED] > > Sent: 05 July 2005 07:28 > &g t; To: Log4NET User > > Subject: 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 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#inte > > rnalDebug > > > > Nicko > > > > > -----Original Message----- > > > From: Gitit Amihud [mailto:[EMAIL PROTECTED] > > > Sent: 26 June 2005 11:54 > > > To: [email protected] > > > 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 agai n 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 > > > > /football.fantasysports.yahoo.com?ovchn=YAH&ovcpn=Integration& > > ovcrn=Mail+footer&ovrfd=YAH&ovtac=AD> > > > > > ________________________________ > > Sell on Yahoo! Auctions > <http://us.lrd.yahoo.com/_ylc=X3oDMTE0bG4ybmRjBF9TAzk1OTQ5NjM2 BHNlYwNtYWlsdGFnBHNsawNhdWN0aW9ucw--/SIG=10vb8ief1/**http%> 3a//auctions.yahoo.com/> - No fees. Bid on great items. >
