Abstract base class for manages writing of logging information to a file.

Namespace:  CuttingEdge.Logging
Assembly:  CuttingEdge.Logging (in CuttingEdge.Logging.dll)

Syntax

Visual Basic (Declaration)
Public MustInherit Class FileLoggingProviderBase _
	Inherits LoggingProviderBase
C#
public abstract class FileLoggingProviderBase : LoggingProviderBase
Visual C++
public ref class FileLoggingProviderBase abstract : public LoggingProviderBase
JavaScript
CuttingEdge.Logging.FileLoggingProviderBase = function();

Type.createClass(
	'CuttingEdge.Logging.FileLoggingProviderBase',
	CuttingEdge.Logging.LoggingProviderBase);

Remarks

Returning an identifier for the logged event is not appropriate for this provider. This provider will always return null (Nothing in VB) from the Log method.

This class is abstract and can not be created directly. See the XmlFileLoggingProvider for a concrete implementation. Implementers can inherit from this class to create a specific logger that allows writing to a file. Implementers should override the SerializeLogEntry(LogEntry) method.

The FileLoggingProviderBase checks upon creation whether the configured file can be created and written to. The provider will fail when this is not the case. When the provider is configured in the application's configuration file, it will invalidate the complete provider model. This enables quick detection of a system's misconfiguration.

The FileLoggingProviderBase does not hold a file lock during the entire life time of the application domain. Instead it will close the file directly after logging a single event. This allows other applications to process that file more easily. This however, can lead to a failure when other processes are writing to this same file. Writing to that file from outside the context of the FileLoggingProviderBase or one of it's implementations is discouraged. Configer a FallbackProvider to prevent a failure to bubble up the call stack.

The following table shows a list of scenario's and for each scenario the table shows whether this scenario can be executed without a change that the provider might fail to log the event.

OperationSafe?
Logging to one FileLoggingProviderBase instance (or one of its decendants) from a single threaded application.Yes
Logging to one FileLoggingProviderBase instance (or one of its decendants) in a single AppDomain from multiple threads.Yes
Logging to multiple FileLoggingProviderBase instances (or its decendants) in a single AppDomain that reference all diferent log files.
Logging to multiple FileLoggingProviderBase instances (or its decendants) in a single AppDomain that all reference the same log file.Yes
Logging to mutliple FileLoggingProviderBase instances (or its decendants) in different AppDomains that reference one single log file.No
Writing to the log file outside the context of an FileLoggingProviderBase instance (or one of its decendants) in that same AppDomain.No
Writing to the log file from within another AppDomain in the same process.No
Writing to the log file from another process.No

Inheritance Hierarchy

See Also