Common Logging 2.0 API Reference

CapturingLoggerFactoryAdapter Class

An adapter, who's loggers capture all log events and send them to AddEvent. Retrieve the list of log events from LoggerEvents.

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

System.Object
   CapturingLoggerFactoryAdapter

[Visual Basic]
Public Class CapturingLoggerFactoryAdapter
    Implements ILoggerFactoryAdapter
[C#]
public class CapturingLoggerFactoryAdapter : ILoggerFactoryAdapter

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

This logger factory is mainly for debugging and test purposes. This is an example how you might use this adapter for testing:

// configure for capturing
CapturingLoggerFactoryAdapter adapter = new CapturingLoggerFactoryAdapter();
LogManager.Adapter = adapter;

// reset capture state
adapter.Clear();
// log something
ILog log = LogManager.GetCurrentClassLogger();
log.DebugFormat("Current Time:{0}", DateTime.Now);

// check logged data
Assert.AreEqual(1, adapter.LoggerEvents.Count);
Assert.AreEqual(LogLevel.Debug, adapter.LastEvent.Level);

Requirements

Namespace: Common.Logging.Simple

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

See Also

CapturingLoggerFactoryAdapter Members | Common.Logging.Simple Namespace