Class NLogDisposableFactory
An actionETL logging factory implementation, using NLog for the logging. Use this class to create your own log factory instance, which can be injected into worker systems, and/or used outside worker systems.
This class is the same as NLogFactory, except that it handles the scenarios where the logging factory must be disposed after use.
Inherited Members
Namespace: actionETL.Logging.NLogExternal
Assembly: actionETL.dll
Syntax
public sealed class NLogDisposableFactory : NLogFactory, IALogFactory, IDisposable
Methods
Create()
Creates a (non-singleton) NLog logging factory, which is not automatically shared with other logging factories, and must be disposed after use.
This method is thread-safe.
If no configuration file is found in the standard locations, a default configuration is created and used (see CreateDefaultConfiguration()).
Declaration
public static NLogDisposableFactory Create()
Returns
| Type | Description |
|---|---|
| NLogDisposableFactory | A (non-singleton) disposable logging factory. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | No NLog logging configuration file found. |
Create(LoggingConfiguration)
Creates a (non-singleton) NLog logging factory (using the provided
LoggingConfiguration), which is not automatically shared with other logging
factories, and must be disposed after use.
This method is thread-safe.
Declaration
public static NLogDisposableFactory Create(LoggingConfiguration loggingConfiguration)
Parameters
| Type | Name | Description |
|---|---|---|
| NLog.Config.LoggingConfiguration | loggingConfiguration | The NLog logging configuration. Provided via an XmlLoggingConfiguration or LoggingConfiguration instance. |
Returns
| Type | Description |
|---|---|
| NLogDisposableFactory | A (non-singleton) disposable logging factory. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Create(Boolean)
Creates a (non-singleton) NLog logging factory, which is not automatically shared with other logging factories, and must be disposed after use.
This method is thread-safe.
Declaration
public static NLogDisposableFactory Create(bool requireConfigurationFile)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | requireConfigurationFile | If set to |
Returns
| Type | Description |
|---|---|
| NLogDisposableFactory | A (non-singleton) disposable logging factory. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | No NLog logging configuration file found. |
Dispose()
Disposes the logging factory.
Declaration
public void Dispose()