Use this TraceListener implementation to route all Entlib logging events to the Common.Logging infrastructure.
For a list of all members of this type, see CommonLoggingEntlibTraceListener Members .
System.Object
MarshalByRefObject
TraceListener
FormattedTraceListenerBase
CommonLoggingEntlibTraceListener
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
See CommonLoggingEntlibTraceListenerData for a list of properties to configure.
To route all Logger events to Common.Logging, configure CommonLoggingEntlibTraceListener:
[XML]
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="loggingConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add name="Common.Logging Listener"
type="Common.Logging.EntLib.CommonLoggingEntlibTraceListener, Common.Logging.EntLib"
listenerDataType="Common.Logging.EntLib.CommonLoggingEntlibTraceListenerData,
Common.Logging.EntLib"
loggerNameFormat="{listenerName}.{sourceName}"
formatter="Text Formatter"
/>
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message: {message}
Category:
{category}
Priority: {priority}
EventId: {eventid}
Severity:
{severity}
Title:{title}
Machine: {machine}
Application Domain:
{appDomain}
Process Id: {processId}
Process Name: {processName}
Win32
Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties:
{dictionary({key} - {value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
name="Text Formatter" />
</formatters>
<specialSources>
<allEvents switchValue="All" name="All Events">
<listeners>
<add name="Test Capturing Listener" />
</listeners>
</allEvents>
</specialSources>
</loggingConfiguration>
</configuration>
Namespace: Common.Logging.EntLib
Assembly: Common.Logging.EntLib (in Common.Logging.EntLib.dll)
CommonLoggingEntlibTraceListener Members | Common.Logging.EntLib Namespace