Use the LogManager's GetLogger or GetLogger methods to obtain ILog instances for logging.
For a list of all members of this type, see LogManager Members .
System.Object
LogManager
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
For configuring the underlying log system using application configuration, see the example at ConfigurationSectionHandler. For configuring programmatically, see the example section below.
The example below shows the typical use of LogManager to obtain a reference to a logger and log an exception:
ILog log = LogManager.GetLogger(this.GetType()); ... try { /* .... */ } catch(Exception ex) { log.ErrorFormat("Hi {0}", ex, "dude"); }The example below shows programmatic configuration of the underlying log system:
// create properties NameValueCollection properties = new NameValueCollection(); properties["showDateTime"] = "true"; // set Adapter Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter(properties);
Namespace: Common.Logging
Assembly: Common.Logging (in Common.Logging.dll)
LogManager Members | Common.Logging Namespace | ILog | Adapter | ILoggerFactoryAdapter | ConfigurationSectionHandler