You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Nicko Cadell <ni...@neoworks.com> on 2005/04/22 20:23:50 UTC

RE: ASP.NET Already Rolled Logfiles Locked and cannot be moved or deleted

The RollingFileAppender only holds a lock on the file it is currently
writing to, not on the rolled files. If the files were locked it would
not be able to move them. The first thing to check is which process is
holding the lock on the file. The Process Explorer tool from
sysinternals (http://www.sysinternals.com/ntw2k/freeware/procexp.shtml)
has a handle search facility which will locate the process that holds a
file handle. I can't remember if this tool can tell you what kind of
lock has been taken.

Cheers,

Nicko

> -----Original Message-----
> From: Mike Williams [mailto:MWilliams@mbasys.co.uk] 
> Sent: 20 April 2005 15:31
> To: Log4net-User-Help
> Subject: ASP.NET Already Rolled Logfiles Locked and cannot be 
> moved or deleted
> 
> We have been using log4net satisfactorily for some time in a 
> number of our projects but in one of our ASP.NET projects 
> where we have a RollingFileAppender set to roll over at 
> midnight, the rolling works fine and creates the correct 
> files and logs into them great. However as these files are 
> getting larger, our Operations team want to move them off the 
> servers and back them up. Unfortunately the server will not 
> let them do it as the OS says the file is in use by another 
> process. We are using log4net version 1.2.9.0 built from the 
> CVS source code. The OS is Windows Server 2003. Is there 
> anything we are doing wrong?
> 
> I attach the log4net config section in case there is anything 
> there that is incorrect.
> 
> 	<log4net>
> 		<appender name="RollingFileAppender"
> type="log4net.Appender.RollingFileAppender">
> 			<layout type="log4net.Layout.PatternLayout">
> 				<param name="ConversionPattern" 
> value="%d [%a][%t] %-5p %c - %m%n" />
> 			</layout>
> 			<param name="File" value="Confirms" />
> 			<param name="AppendToFile" value="true" />
> 			<param name="RollingStyle" value="Date" />
> 			<param name="DatePattern" 
> value="'-'yyyyMMdd'.log'"
> />
> 			<param name="StaticLogFileName" value="false" />
> 		</appender>
> 		<appender name="EventLogAppender"
> type="log4net.Appender.EventLogAppender">
> 			<param name="ApplicationName"
> value="Mba.Confirms.Info" />
> 			<layout type="log4net.Layout.PatternLayout">
> 				<param name="ConversionPattern" 
> value="%d [%a][%t] %-5p %c - %m%n" />
> 			</layout>
> 			<filter type="log4net.Filter.LevelRangeFilter">
> 				<param name="LevelMin" value="ERROR" />
> 				<param name="LevelMax" value="FATAL" />
> 			</filter>
> 		</appender>
> 		<root>
> 			<level value="DEBUG" />
> 			<appender-ref ref="RollingFileAppender" />
> 			<appender-ref ref="EventLogAppender" />
> 		</root>
> 	</log4net>
> 
> Thanks in advance
> Mike
> 
>  
> Dr. Mike Williams
> Technical Director
> MBA Systems Ltd.
> --------------------------------------------------------------
> --------------
> This email and any files transmitted with it are intended 
> solely for the
> addressee(s) and may be legally privileged and/or 
> confidential. If you have received this email in error please 
> destroy it and contact the sender, via our switchboard on +44 
> (0)1962 841494 or via return e-mail. You should not copy, 
> forward or use the contents, attachments or information in any way.
> Any unauthorised use or disclosure may be unlawful. MBA 
> Systems gives no warranty as to the accuracy or completeness 
> of this email after it is sent over the Internet and accepts 
> no responsibility for changes made after it was sent. Any 
> opinion expressed in this email may be personal to the author 
> and may not necessarily reflect the opinions of MBA Systems 
> or its affiliates. They may also be subject to change without notice.
> --------------------------------------------------------------
> --------------
>