More to the point, have you searched the archives? That question has come up several times on this email list. There are several solutions. In general, synchronized access to an in-memory object is better than synchronized access to something on a filesystem (especially a network filesystem).

Georg Jansen wrote:
Have you considered going against the company standard?

Sometimes you get into a lot of trouble, sometimes you
change the company standard and become a hero.. :-)

Regards

Georg

http://www.l4ndash.com <http://www.l4ndash.com/>  - Log4Net Dashboard / Log
Viewer

_____ From: Ramaa Davanagere [mailto:[EMAIL PROTECTED] Sent: 4. november 2005 18:28
To: 'Log4NET User'
Subject: RE: What do I need to do to get rid of this error? Please help

Nope. I can't. Acc to our company standards, logging/tracing should be
written to text files only.

-----Original Message-----
From: Georg Jansen [mailto:[EMAIL PROTECTED] Sent: Friday, November 04, 2005 12:26 PM
To: 'Log4NET User'
Subject: RE: What do I need to do to get rid of this error? Please help

Hi,

This may not be the answer you are looking for,

but have you considered writing the log events
to a database instead, using the AdoNetAppender.

Regards,

Georg

http://www.l4ndash.com <http://www.l4ndash.com/>  - Log4Net Dashboard / Log
Viewer

_____ From: Ramaa Davanagere [mailto:[EMAIL PROTECTED] Sent: 4. november 2005 18:12
To: 'Log4NET User'
Subject: RE: What do I need to do to get rid of this error? Please help

I wish it was that easy!!!!

I have multiple components (20+) using the same log file for logging
messages.  I don't think I can check which of the components is currently
locking the files, before writing log messages.

How do I resolve this?

-----Original Message-----
From: Shireesh Thanneru [mailto:[EMAIL PROTECTED] Sent: Friday, November 04, 2005 11:55 AM
To: Log4NET User
Subject: Re: What do I need to do to get rid of this error? Please help

You need to make sure that no other process/program is accessing the the
file at "C:\Program Files\Mobius\contenuity\LogFiles\vdrconBOLog.txt"

so that log4net can acquire a lock on that file.

Ramaa Davanagere <[EMAIL PROTECTED]> wrote:

log4net: RollingFileAppender: Searched for existing files in [C:\Program
Files\Mobius\contenuity\LogFiles]

log4net: RollingFileAppender: curSizeRollBackups starts at [0]

log4net: FileAppender: Opening file for writing [C:\Program
Files\Mobius\contenuity\LogFiles\vdrconBOLog.txt] append [True]

log4net:ERROR [RollingFileAppender] Unable to acquire lock on file
C:\Program Files\Mobius\contenuity\LogFiles\vdrconBOLog.txt. The process
cannot access the file "C:\Program
Files\Mobius\contenuity\LogFiles\vdrconBOLog.txt" because it is being used
by another process.

log4net:ERROR [RollingFileAppender] OpenFile(C:\Program
Files\Mobius\contenuity\LogFiles\vdrconBOLog.txt,True) call failed.

LockStateException: The file is not currently locked

   at log4net.Appender.LockingStream.AssertLocked()

   at log4net.Appender.LockingStream.get_CanWrite()

   at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding, Int32
bufferSize)

   at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding)

   at log4net.Appender.FileAppender.OpenFile(String fileName, Boolean
append)

   at log4net.Appender.RollingFileAppender.OpenFile(String fileName, Boolean
append)

   at log4net.Appender.FileAppender.SafeOpenFile(String fileName, Boolean
append)

log4net: FileAppender: Opening file for writing [C:\Program
Files\Mobius\contenuity\LogFiles\vdrconBOLog.txt] append [True]

Reply via email to