EDN Admin
Well-known member
Hi there,<br/> <br/> Ive been attempting to set up Enterprise Library 4.1 logging on a web application. Nothing appeared to be happening so I scaled back to a console application still without success. My console application contains the lines Logger.Write("Test") and Logger.Write("2nd test", "Category", 1, 1, TraceEventType.Error). However executing it appears to do nothing, not even an exception is raised. No messages or errors are logged to the rolling flat file, event log, or e-mail. Ive tried using the Quick Start from the included source code and this works! Does anyone have some ideas? Below is my config file:<br/> <br/>
<pre lang=x-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=31bf3856ad364e35" />
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="Information" logWarningsWhenNoCategoriesMatch="true
<listeners>
<add toAddress="toaddress@domain.com" fromAddress="fromaddress@domain.com"
subjectLineStarter="Alert: " subjectLineEnder="SERVER01"
smtpServer="smtpd1" smtpPort="25" formatter="MultiLine Text Formatter"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Email TraceListener" />
<add source="Enterprise Library Logging" formatter="MultiLine Text Formatter"
log="Application" machineName="." listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Formatted EventLog TraceListener" />
<add fileName="c:logrolling.log" footer="" formatter="SingleLine Text Formatter"
header="" rollFileExistsBehavior="Increment" rollInterval="Day"
rollSizeKB="0" timeStampPattern="yyyy-MM-dd" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Rolling Flat File Trace Listener" />
</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=31bf3856ad364e35"
name="MultiLine Text Formatter" />
<add template="{timestamp(local)} GMT{tab}{title}{tab}{message}{tab}{category}{tab}{priority}{tab}{eventid}{tab}{severity}{tab}{machine}{tab}{appDomain}{tab}{processId}{tab}{processName}{tab}{win32ThreadId}{tab}{threadName}{tab}{dictionary({key} - {value}{tab})}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="SingleLine Text Formatter" />
</formatters>
<categorySources>
<add switchValue="Error" name="Error
<listeners>
<add name="Email TraceListener" />
<add name="Formatted EventLog TraceListener" />
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="Information" name="Information
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="Warning" name="Warning
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings" />
</specialSources>
</loggingConfiguration>
</configuration>
[/code]
Thanks for any help you can provide!<br/> <br/> Alex Angas.<hr class="sig Alex Angas - http://alexangas.wordpress.com/
View the full article
<pre lang=x-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=31bf3856ad364e35" />
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="Information" logWarningsWhenNoCategoriesMatch="true
<listeners>
<add toAddress="toaddress@domain.com" fromAddress="fromaddress@domain.com"
subjectLineStarter="Alert: " subjectLineEnder="SERVER01"
smtpServer="smtpd1" smtpPort="25" formatter="MultiLine Text Formatter"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Email TraceListener" />
<add source="Enterprise Library Logging" formatter="MultiLine Text Formatter"
log="Application" machineName="." listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Formatted EventLog TraceListener" />
<add fileName="c:logrolling.log" footer="" formatter="SingleLine Text Formatter"
header="" rollFileExistsBehavior="Increment" rollInterval="Day"
rollSizeKB="0" timeStampPattern="yyyy-MM-dd" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="Timestamp" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Rolling Flat File Trace Listener" />
</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=31bf3856ad364e35"
name="MultiLine Text Formatter" />
<add template="{timestamp(local)} GMT{tab}{title}{tab}{message}{tab}{category}{tab}{priority}{tab}{eventid}{tab}{severity}{tab}{machine}{tab}{appDomain}{tab}{processId}{tab}{processName}{tab}{win32ThreadId}{tab}{threadName}{tab}{dictionary({key} - {value}{tab})}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="SingleLine Text Formatter" />
</formatters>
<categorySources>
<add switchValue="Error" name="Error
<listeners>
<add name="Email TraceListener" />
<add name="Formatted EventLog TraceListener" />
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="Information" name="Information
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
<add switchValue="Warning" name="Warning
<listeners>
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings" />
</specialSources>
</loggingConfiguration>
</configuration>
[/code]
Thanks for any help you can provide!<br/> <br/> Alex Angas.<hr class="sig Alex Angas - http://alexangas.wordpress.com/
View the full article