The log4net Global Context.
Inheritance Hierarchy
log4netGlobalContext
Namespace: log4net
Assembly: log4net (in log4net.dll) Version: 2.0.6.0-.NET 4.0
Syntax
The GlobalContext type exposes the following members.
Properties
Name | Description | |
---|---|---|
Properties |
The global properties map.
|
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
GetHashCode |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
GetType |
Gets the Type of the current instance.
(Inherited from Object.) | |
ToString | (Inherited from Object.) |
Remarks
The GlobalContext provides a location for global debugging information to be stored.
The global context has a properties map and these properties can be included in the output of log messages. The PatternLayout supports selecting and outputing these properties.
By default the log4net:HostName property is set to the name of the current machine.
Examples
C#
GlobalContext.Properties["hostname"] = Environment.MachineName;
Thread Safety
See Also