Common Logging 2.0 API Reference

CommonLoggingTarget Class

Routes all log events logged through NLog into the Common.Logging infrastructure.

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

System.Object
   Target
      TargetWithLayout
         CommonLoggingTarget

[Visual Basic]
Public Class CommonLoggingTarget
    Inherits TargetWithLayout
[C#]
public class CommonLoggingTarget : TargetWithLayout

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

To route all NLog events to Common.Logging, you must add this target to your configuration:

LoggingConfiguration cfg = new LoggingConfiguration();
CommonLoggingTarget target = new CommonLoggingTarget("${level:uppercase=true}|${logger}|${message}");
cfg.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, target));

LogManager.Configuration = cfg;

Logger log = LogManager.GetLogger("mylogger");
log.Debug("some message");

Requirements

Namespace: Common.Logging.NLog

Assembly: Common.Logging.NLog (in Common.Logging.NLog.dll)

See Also

CommonLoggingTarget Members | Common.Logging.NLog Namespace