GlobalContext ClassApache log4net™ SDK Documentation
The log4net Global Context.
Inheritance Hierarchy

SystemObject
  log4netGlobalContext

Namespace: log4net
Assembly: log4net (in log4net.dll) Version: 2.0.6.0-.NET 4.0
Syntax

public sealed class GlobalContext

The GlobalContext type exposes the following members.

Properties

  NameDescription
Public propertyStatic memberProperties
The global properties map.
Top
Methods

  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
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

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
See Also

Reference