What am I doing wrong? I'd appreciate if someone could take a look at the web.config:
1 <configSections>
2 <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
3 <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
4 <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
5 </configSections>
6 <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
7 defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
8 <listeners>
9 <add fileName="c:\custtemplog.log" header="----------------------------------------"
10 footer="----------------------------------------" formatter="Text Formatter"
11 listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
12 traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
13 name="FlatFile TraceListener" />
14 <add source="Enterprise Library Logging" formatter="Text Formatter"
15 log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
16 traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
17 name="Formatted EventLog TraceListener" />
18 </listeners>
19 <formatters>
20 <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}
)}"
21 type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
22 name="Text Formatter" />
23 </formatters>
24 <categorySources>
25 <add switchValue="All" name="Trace">
26 <listeners>
27 <add name="FlatFile TraceListener" />
28 </listeners>
29 </add>
30 <add switchValue="All" name="General">
31 <listeners>
32 <add name="Formatted EventLog TraceListener" />
33 </listeners>
34 </add>
35 </categorySources>
36 <specialSources>
37 <allEvents switchValue="All" name="All Events" />
38 <notProcessed switchValue="All" name="Unprocessed Category" />
39 <errors switchValue="All" name="Logging Errors & Warnings">
40 <listeners>
41 <add name="Formatted EventLog TraceListener" />
42 </listeners>
43 </errors>
44 </specialSources>
45 </loggingConfiguration>
46 <exceptionHandling>
47 <exceptionPolicies>
48 <add name="Global policy">
49 <exceptionTypes>
50 <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
51 postHandlingAction="NotifyRethrow" name="Exception">
52 <exceptionHandlers>
53 <add logCategory="Trace" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
54 formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
55 priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
56 name="Logging Handler" />
57 </exceptionHandlers>
58 </add>
59 </exceptionTypes>
60 </add>
61 </exceptionPolicies>
62 </exceptionHandling>
I've included the dll files necessary but when I try
try
{
throw new Exception();
}
catch (Exception ex)
{
ExceptionPolicy.HandleException(ex, "Global policy");
}
Nothing happends. Please help!