log4net SDK Reference

GlobalContext Class

The log4net Global Context.

For a list of all members of this type, see GlobalContext Members.

System.Object
   log4net.GlobalContext

[Visual Basic]
NotInheritable Public Class GlobalContext
[C#]
public sealed class GlobalContext

Thread Safety

This type is safe for multithreaded operations.

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.

Example

[C#]
GlobalContext.Properties["hostname"] = Environment.MachineName;

Requirements

Namespace: log4net

Assembly: log4net (in log4net.dll)

See Also

GlobalContext Members | log4net Namespace