By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,686 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,686 IT Pros & Developers. It's quick & easy.

EnterpriseLibrary 2.0 Exception and logging block

P: n/a
Please help me in resolving this issue.
I am using EnterpriseLibrary 2.0 Exception and logging block for
logging exceptions to event log. It works fine for sometime. After some
time it stops logging to event log. To make it active again I need to
open the web.config and save without making any changes. It starts to
work again.

Here is the configuration I am using.

<exceptionHandling>
<exceptionPolicies>
<add name="My Policy">
<exceptionTypes>
<add name="System Exception" type="System.Exception, mscorlib"
postHandlingAction="None">
<exceptionHandlers>
<add logCategory="ExceptionBlockCategory" eventId="100"
severity="Error" title="App Admin" priority="0"
formatterType="Microsoft.Practices.EnterpriseLibra ry.ExceptionHandling.TextExceptionFormatter,
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling" name="Logging
Handler"
type="Microsoft.Practices.EnterpriseLibrary.Except ionHandling.Logging.LoggingExceptionHandler,
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.Logging"></add>
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
<loggingConfiguration defaultCategory="ExceptionBlockCategory"
tracingEnabled="true">
<categorySources>
<add name="ExceptionBlockCategory" switchValue="All">
<listeners>
<add name="ExceptionBlockEventListener"/>
</listeners>
</add>
<add switchValue="All" name="Trace">
<listeners>
<add name="FlatFile TraceListener"/>
</listeners>
</add>
</categorySources>
<specialSources>
<errors name="errors" switchValue="All">
<listeners>
<add name="ExceptionBlockErrorListener"/>
<add name="FlatFile TraceListener"/>
</listeners>
</errors>
</specialSources>
<listeners>
<add name="ExceptionBlockEventListener"
type="Microsoft.Practices.EnterpriseLibrary.Loggin g.TraceListeners.FormattedEventLogTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging"
listenerDataType="Microsoft.Practices.EnterpriseLi brary.Logging.Configuration.FormattedEventLogTrace ListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging" source="Priya"
formatter="ExceptionBlockFormatter"/>
<add name="ExceptionBlockErrorListener"
type="Microsoft.Practices.EnterpriseLibrary.Loggin g.TraceListeners.FormattedEventLogTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging"
listenerDataType="Microsoft.Practices.EnterpriseLi brary.Logging.Configuration.FormattedEventLogTrace ListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging" source="Application"
formatter="ExceptionBlockFormatter"/>
<add name="FlatFile TraceListener" fileName="trace.log"
header="----------------------------------------"
footer="----------------------------------------" formatter="Trace
Format"
listenerDataType="Microsoft.Practices.EnterpriseLi brary.Logging.Configuration.FlatFileTraceListenerD ata,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null" traceOutputOptions="None"
type="Microsoft.Practices.EnterpriseLibrary.Loggin g.TraceListeners.FlatFileTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null" />
</listeners>
<formatters>
<add name="ExceptionBlockFormatter"
type="Microsoft.Practices.EnterpriseLibrary.Loggin g.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging" 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; )}"/>
<add template="Timestamp: {timestamp}&#xA; [Title: {title}]
&#xA;Message: {message}&#xA;"
type="Microsoft.Practices.EnterpriseLibrary.Loggin g.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null" name="Trace Format"/>
</formatters>
</loggingConfiguration>
Please help.

Nov 7 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.