Also ensure that the identity under which your webservice is running has
write permissions to the folder
"c:\inetpub\wwwroot\log4net_webservice_prototype\".
Thanks,
Hemant
Nicko Cadell writes:
Have you specified a <lockingModel> on the RollingFileAppender? The
default locking model takes an exclusive lock on the output file. Do you
have multiple processes writing to the same log file? As it is a web
service are you using a web garden or other form of clustering or
pooling? Do you have some other process that would be preventing a write
lock from being obtained on the file.
If you have multiple processes using the same output file you can
configure the RollingFileAppender to use the minimal locking model which
only opens the file to write the message and then closes it. Add the
following to your RollingFileAppender config:
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
Cheers,
Nicko
-----Original Message-----
From: Kremer, Mark [mailto:[EMAIL PROTECTED]
Sent: 20 June 2005 18:42
To: [email protected]
Subject: logging web services
I am trying to log from a web service, and am getting errors
about acquiring locks on the output file. What extra steps
need to be performed to use log4net to log web services? Here
is my internal debugging:
log4net:ERROR [RollingFileAppender] Unable to acquire lock on
file
c:\inetpub\wwwroot\log4net_webservice_prototype\arc_prototype.
Form1.log. Access to the path
"c:\inetpub\wwwroot\log4net_webservice_prototype\arc_prototype
.Form1.log" is denied.
log4net: FileAppender: Opening file for writing
[c:\inetpub\wwwroot\log4net_webservice_prototype\arc_prototype
.Form1.log] append [True]
log4net:ERROR [RollingFileAppender] Unable to acquire lock on
file
c:\inetpub\wwwroot\log4net_webservice_prototype\arc_prototype.
Form1.log. Access to the path
"c:\inetpub\wwwroot\log4net_webservice_prototype\arc_prototype
.Form1.log" is denied.
log4net:ERROR [RollingFileAppender]
OpenFile(c:\inetpub\wwwroot\log4net_webservice_prototype\arc_p
rototype.Form1.log,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:ERROR [RollingFileAppender]
No output stream or file set for the appender named
[Form1RollingFile].
__________________________________________________
Mark Kremer
User Interface Specialist
ZOLL Data Systems
12202 Airport Way, Suite 300
Broomfield, Colorado 80021
O (303) 801-1833
F (303) 801-0001
www.zolldata.com