Class FileAppender.ExclusiveLock
Hold an exclusive lock on the output file
public class FileAppender.ExclusiveLock : FileAppender.LockingModelBase
- Inheritance
-
FileAppender.ExclusiveLock
- Inherited Members
Remarks
Open the file once for writing and hold it open until CloseFile() is called. Maintains an exclusive lock on the file during this time.
Constructors
ExclusiveLock()
public ExclusiveLock()
Methods
AcquireLock()
Acquire the lock on the file
public override Stream AcquireLock()
Returns
- Stream
A stream that is ready to be written to.
Remarks
Does nothing. The lock is already taken
ActivateOptions()
Initializes all resources used by this locking model.
public override void ActivateOptions()
CloseFile()
Close the file
public override void CloseFile()
Remarks
Close the file. No further writes will be made.
OnClose()
Disposes all resources that were initialized by this locking model.
public override void OnClose()
OpenFile(string, bool, Encoding)
Open the file specified and prepare for logging.
public override void OpenFile(string filename, bool append, Encoding encoding)
Parameters
filenamestringThe filename to use
appendboolWhether to append to the file, or overwrite
encodingEncodingThe encoding to use
Remarks
Open the file specified and prepare for logging. No writes will be made until AcquireLock() is called. Must be called before any calls to AcquireLock(), ReleaseLock() and CloseFile().
ReleaseLock()
Release the lock on the file
public override void ReleaseLock()
Remarks
Does nothing. The lock will be released when the file is closed.