I am using version 1.2.9 of log4Net. I tried working with this and found that with Minimal Locking the FileShare mode is FileShare.Read. So any other process which even tries to open the file for writing will get an exception. But if the FileShare mode is made as ReadWrite, it seems to work fine for multiple processes.
I also found that if RollingFileAppender is made to rollover based on Size of file where maxRollovers > 1 - then when multiple processes are writing to the same file it causes a problem. Because the typical naming convention of the file on rollovers is logFile.log, logFile.log.1, logFile.log.2 and so on. If currently the first process P1 rolled over the file based on size to LogFile.log.1, it internally knows that the next name should be 'logFile.log.2'. Process P2 on the other hand does not know that the next name during rollover should be 'logFile.log.2'. For P2, the next file name would still be 'logFile.log.1'. So if it ever happens that when P2 is writing to logFile.log and the size exceeds, then P2 would simply rename the file to logFile.log.1 (overwriting the previous file that was created). Is there some setting that needs to be specified that can overcome this issue? With rollover based on date - I think it should work fine, though I have not tried it. Thanks, Meera. -----Original Message----- From: Ron Grabowski [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 19, 2006 4:15 PM To: Log4NET User Subject: Re: Question about the RollingFileAppender Starting with version 1.2.9, you can define the locking model for a FileAppender. The default value is an ExclusiveLock which means the FileAppender has a lock on the file for the duration of the application. The MinimalLock opens and closes the file on each write. Here an example showing how to set the lockingModel property: http://tinyurl.com/7sqon http://logging.apache.org/log4net/release/config-examples.html#fileappen der --- [EMAIL PROTECTED] wrote: > Does the RollingFileAppender (or the FileAppender) have the ability > to have several processes all log to the same log file? This would > really be helpful, so if we have some bug that involves more than one > process. I guess it would have to open the file and prevent others > from opening it in read/write mode in order for that to work, and it > would probably also need to have retries built into it, so that if > one of the other processes is currently writing to it, it keeps on > trying. > > BTW, I'm using log4net 1.1.1. Not sure if that makes a difference. > > Thanks in advance, > > Dan > ________________________________________________________________________ This email has been scanned for all viruses and found to be virus free. If you have questions regarding this scanning please visit the Information Services area of http://home.vitalimages.com ________________________________________________________________________
