C# Class NLog.Internal.FileAppenders.MutexMultiProcessFileAppender

Provides a multiprocess-safe atomic file appends while keeping the files open.
On Unix you can get all the appends to be atomic, even when multiple processes are trying to write to the same file, because setting the file pointer to the end of the file and appending can be made one operation. On Win32 we need to maintain some synchronization between processes (global named mutex is used for this)
Inheritance: BaseFileAppender
ファイルを表示 Open project: NLog/NLog

Public Properties

Property Type Description
TheFactory IFileAppenderFactory

Public Methods

Method Description
Close ( ) : void

Closes this instance.

Flush ( ) : void

Flushes this instance.

GetFileCreationTimeUtc ( ) : DateTime?

Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal Time [UTC] standard.

GetFileLastWriteTimeUtc ( ) : DateTime?

Gets the last time the file associated with the appeander is written. The time returned is in Coordinated Universal Time [UTC] standard.

GetFileLength ( ) : long?

Gets the length in bytes of the file associated with the appeander.

MutexMultiProcessFileAppender ( string fileName, ICreateFileParameters parameters ) : NLog.Common

Initializes a new instance of the MutexMultiProcessFileAppender class.

Write ( byte bytes ) : void

Writes the specified bytes.

Protected Methods

Method Description
CreateArchiveMutex ( ) : Mutex

Creates a mutually-exclusive lock for archiving files.

Private Methods

Method Description
GetFileCharacteristics ( ) : FileCharacteristics

Method Details

Close() public method

Closes this instance.
public Close ( ) : void
return void

CreateArchiveMutex() protected method

Creates a mutually-exclusive lock for archiving files.
protected CreateArchiveMutex ( ) : Mutex
return System.Threading.Mutex

Flush() public method

Flushes this instance.
public Flush ( ) : void
return void

GetFileCreationTimeUtc() public method

Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal Time [UTC] standard.
public GetFileCreationTimeUtc ( ) : DateTime?
return DateTime?

GetFileLastWriteTimeUtc() public method

Gets the last time the file associated with the appeander is written. The time returned is in Coordinated Universal Time [UTC] standard.
public GetFileLastWriteTimeUtc ( ) : DateTime?
return DateTime?

GetFileLength() public method

Gets the length in bytes of the file associated with the appeander.
public GetFileLength ( ) : long?
return long?

MutexMultiProcessFileAppender() public method

Initializes a new instance of the MutexMultiProcessFileAppender class.
public MutexMultiProcessFileAppender ( string fileName, ICreateFileParameters parameters ) : NLog.Common
fileName string Name of the file.
parameters ICreateFileParameters The parameters.
return NLog.Common

Write() public method

Writes the specified bytes.
public Write ( byte bytes ) : void
bytes byte The bytes to be written.
return void

Property Details

TheFactory public_oe static_oe property

public static IFileAppenderFactory TheFactory
return IFileAppenderFactory