logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: logging web services
Date Mon, 20 Jun 2005 19:46:00 GMT
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:MKremer@zolldata.com] 
> Sent: 20 June 2005 18:42
> To: log4net-user@logging.apache.org
> 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 
> 
> 

Mime
View raw message