EHB not logging on Web Server 08

Topics: Exception Handling Application Block, Logging Application Block
Nov 12, 2008 at 4:23 PM
We have created a Web Site with the WCSF and Ent LIB 3.1 in VS 2008.

Our Exceptions are generating emails but they are not writing anything to the Event Log. Our web server is running Server 2008 Web Edition, I've noticed it the Event Viewer is very different from 03.

Below is snippet from web.config:

<

loggingConfiguration name="Logging Application Block" tracingEnabled="true"

 

 

defaultCategory="" logWarningsWhenNoCategoriesMatch="true">

 

<

listeners>

 

<

add toAddress="you@our.com" fromAddress="me@our.com"

 

 

subjectLineStarter="" subjectLineEnder="" smtpServer="10.10.10.257"

 

 

smtpPort="25" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

name="Email TraceListener" />

 

<

add source="LCenter Logging" formatter="Text Formatter" log="Application"

 

 

machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

name="Formatted EventLog TraceListener" />

 

</

listeners>

 

<

formatters>

 

<

add template="Timestamp: {timestamp}&#xA;Message: {message}&#xA;Category: {category}&#xA;Priority: {priority}&#xA;EventId: {eventid}&#xA;Severity: {severity}&#xA;Title:{title}&#xA;Machine: {machine}&#xA;Application Domain: {appDomain}&#xA;Process Id: {processId}&#xA;Process Name: {processName}&#xA;Win32 Thread Id: {win32ThreadId}&#xA;Thread Name: {threadName}&#xA;Extended Properties: {dictionary({key} - {value}&#xA;)}"

 

 

type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

name="Text Formatter" />

 

</

formatters>

 

<

categorySources>

 

<

add switchValue="All" name="Business Rules Exceptions Logging">

 

<

listeners>

 

<

add name="Email TraceListener" />

 

<

add name="Formatted EventLog TraceListener" />

 

</

listeners>

 

</

add>

 

<

add switchValue="All" name="Services Exceptions Logging">

 

<

listeners>

 

<

add name="Email TraceListener" />

 

<

add name="Formatted EventLog TraceListener" />

 

</

listeners>

 

</

add>

 

</

categorySources>

 

<

specialSources>

 

<

allEvents switchValue="All" name="All Events" />

 

<

notProcessed switchValue="All" name="Unprocessed Category" />

 

<

errors switchValue="All" name="Logging Errors &amp; Warnings">

 

<

listeners>

 

<

add name="Formatted EventLog TraceListener" />

 

</

listeners>

 

</

errors>

 

</

specialSources>

 

</

loggingConfiguration>

 

<

exceptionHandling>

 

<

exceptionPolicies>

 

<

add name="Services Exception Policy">

 

<

exceptionTypes>

 

<

add type="System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

 

 

postHandlingAction="NotifyRethrow" name="SqlException">

 

<

exceptionHandlers>

 

<

add logCategory="Services Exceptions Logging" eventId="101"

 

 

severity="Error" title="Services Layer SQLException" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

name="Logging Handler" />

 

</

exceptionHandlers>

 

</

add>

 

<

add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

 

 

postHandlingAction="NotifyRethrow" name="Exception">

 

<

exceptionHandlers>

 

<

add logCategory="Services Exceptions Logging" eventId="100"

 

 

severity="Error" title="Services Layer Exception" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

name="Logging Handler" />

 

</

exceptionHandlers>

 

</

add>

 

</

exceptionTypes>

 

</

add>

 

<

add name="Business Rules Exception Policy">

 

<

exceptionTypes>

 

<

add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

 

 

postHandlingAction="NotifyRethrow" name="Exception">

 

<

exceptionHandlers>

 

<

add logCategory="Business Rules Exceptions Logging"

 

 

eventId="200" severity="Error" title="Business Rules Layer Exception"

 

 

formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

 

 

name="Logging Handler" />

 

</

exceptionHandlers>

 

</

add>

 

</

exceptionTypes>

 

</

add>

 

</

exceptionPolicies>

 

</

exceptionHandling>

 

Nov 13, 2008 at 4:12 AM
Hi,

I tried using your config, seems to be working and logging to event log. have you tried your config to log to a flatfile? and see if it works?


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com