ExceptionPolicy logs differently to event log than to text log

I am implementing an exception policy in the business layer and in the presentation layer of my web application as per the block below.  When an exception happens in the business layer, it bubbles on up to the aspx, which in turn throws the error, thus invoking the default error page defined in web.config.  All well and good. 

The strangeness is that only one exception is logged to the event log, but both throws are caught in the text log.  Why the discrepancy?

Thanks. 

 

        Catch ex As Exception
            Dim rethrow As Boolean
            rethrow = ExceptionPolicy.HandleException(ex, "ExceptionErrorLogPolicy")
            If rethrow Then
                Throw ex
            End If
        End Try

web.config-----------------------------------------------

1      <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
2        defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
3        <listeners>
4          <add fileName="OAWeb.log" header="----------------------------------------"
5            footer="----------------------------------------" formatter="TextLogFormatter"
6            listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
7            traceOutputOptions="Callstack" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
8            name="FlatFile TraceListener" />
9          <add source="Enterprise Library Logging" formatter="Text Formatter"
10           log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
11           traceOutputOptions="Callstack" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
12           name="Formatted EventLog TraceListener" />
13       </listeners>
14       <formatters>
15         <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}
)}"
16           type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
17           name="Text Formatter" />
18         <add template="Timestamp: {timestamp}
Message: {message}
"
19           type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
20           name="TextLogFormatter" />
21       </formatters>
22       <categorySources>
23         <add switchValue="All" name="General">
24           <listeners>
25             <add name="FlatFile TraceListener" />
26             <add name="Formatted EventLog TraceListener" />
27           </listeners>
28         </add>
29       </categorySources>
30       <specialSources>
31         <allEvents switchValue="All" name="All Events" />
32         <notProcessed switchValue="All" name="Unprocessed Category" />
33         <errors switchValue="All" name="Logging Errors & Warnings">
34           <listeners>
35             <add name="FlatFile TraceListener" />
36             <add name="Formatted EventLog TraceListener" />
37           </listeners>
38         </errors>
39       </specialSources>
40     </loggingConfiguration>
41     <exceptionHandling>
42       <exceptionPolicies>
43         <add name="ExceptionErrorLogPolicy">
44           <exceptionTypes>
45             <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
46               postHandlingAction="NotifyRethrow" name="Exception">
47               <exceptionHandlers>
48                 <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
49                   formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
50                   priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
51                   name="Logging Handler" />
52               </exceptionHandlers>
53             </add>
54           </exceptionTypes>
55         </add>
56       </exceptionPolicies>
57     </exceptionHandling>
 
 
0
Sumta
11/21/2008 9:46:54 PM
asp.net.application-block 1007 articles. 0 followers. Follow

0 Replies
1187 Views

Similar Articles

[PageSpeed] 29
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

Events are being logged to the "Application" log instead of custom log
Hi Pros, I have a weird problem here. I am logging from my .NET app to a custom log, but unfortunately, the events are redirected to the Application log. I am sure that I am specifying the log name and the source name accurately. I am using some code like the following:  1 Hi Pros, 2 3 I have a weird problem here. I am logging from my .NET app to a custom log, but unfortunately, the events are redirected to the Application log. I am sure that I am specifying the log name and the source name accurately. I am using some code like the following: 4 5 6 EventLog e...

Logged In As: Not Logged In
I installed ZCF 10.0.1 on a Win 2K3 server and when I install the ZEN client on a workstation the ZENWORKS client login comes up and I cannot log into it. It shows me the realm name of my tree and Zenworks Zone and I have tried both to no avail. When I look at the details of the adaptive agent it says, "Logged In As: Not Logged In" Any ideas? On Fri, 11 Jan 2008 14:55:21 GMT, Jayson E. Hahn wrote: > Any ideas? Debug logs in ZCM http://www.novell.com/support/search.do?cmd=displayKC&docType=kc&externalId=3418069&sliceId=SAL_Public&dialogID=51010132...

To log or not to log
Hello foremen, on a large database, trillions of SELECTs and DELETEs are going to be performed. After that, the database is going to be unloaded. The database uses a transaction log. Should I keep the log there along this process or "unmount" it after some parts of it (or even before the beginning)? In this case, nothing but the speed is important. The database is ASA 7.0.4.3498. Thanks Pavel LOG... ALWAYS LOG. Performance is dependent on the use of the log. Recommendations: 1) Ensure that the file system is not excessively fragmented 2) Host the db f...

Logging log
Hi! I try to accomplish task described in http://forums.novell.com/novell-product-support-forums/zenworks/configuration-management/zcm-server-install/422609-mixed-login.html?pagenumber= and wonder I don't know how to keep log of logging? I mean, does ZCM is capable to keep logging log? As Altiris NS does? More thanks, Alar. -- NovAlf ------------------------------------------------------------------------ You look like you want to log in to your zone as a user from either a eDIR or AD. And yes this is possible, it will search both Directories. http://www.theurbanp...

Logging Application Block not writing to Event Log on Windows 2000 SP4
Hi. I am having issues logging to the Event Log. Although my code is able to log in the Event Log n my Windows XP box with VS2005, when I deploy to the DEV machine it does not. The DEV box has Windows Server 2000 SP4. I've added another loggingConfiguration listener that instead uses the FlatFileTraceListenerData instead of the FormattedEventLogTraceListenerData and it also works both on my local machine and on the DEV server. Just to ensure permissions are not an issue I've setup my website to use a local admin account for Anonymous Access under Authentication Methods. ...

Application Log logging
Shaun, I have been getting complaints from our techs here about the huge amount of entries Patchlink is writing to the Application log. The problem is when they are trying to troubleshoot a problem on a PC, the application log has filled up with the Zenworks Patch Management Agent entries, pushing out the entries they need for troubleshooting. Aside from increasing the size of the Event logs, is there a way to "throttle" down the entries Patchlink is making? 6.3.2.700 server 6.3.2.858 agent Bob -- bstayskal Bstayskal, what level do you have the agent ...

Event Log not Logging ??
 Hi All, On my dev machine when I log errors to the event log all works great however when I move the web application to the test server the events are not being logged... I am hoping it is some configuration issue with IIS however I am totally lost.The code writing the events: EventLog.WriteEntry("xxxxx", err, EventLogEntryType.Error);   Any help will be appreciated. Thanks,Neil  are you getting an error? Sometimes, its a permissions issue, if the log name doesn't exist, it tries to write the new value to the registry. Check the application log...

MS Logging Application Block only writes Information type entries in the Event Log
I just started and gone the MS Logging Application Block working fine, except it only stores Information type entries. The previous method System.Diagnostics.EventLog.WriteEntry allowed me to pass an EventLogEntryType which would result in the type and icon appearing in the Event Viewer.  Can anyone tell me how to do this with the MS Logging Application Block or direct me to an example? Thank you!...

Asynchronous logging using logging application block
Hi,  Is it possible to have Asynchronous logging using LAB? I also wanted to know the advantages of LAB over Log4Net. Or should I go for writing my own asynchronous logger?   Please Help, Robin Hi,  rboin.dock:Is it possible to have Asynchronous logging using LAB? NO the LAB is not Asynchronous by default.  But you can make it Asynchronous using MSMQ  rboin.dock:I also wanted to know the advantages of LAB over Log4Net.   LAB is one of the most complex application block articture wise. it supports many listeners and it is highly configurable. ...

Event Log : Inaccessible logs
 I am getting exception The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.at if (!EventLog.SourceExists(eventSource)) at function WriteExceptionToEventLogIf i login as windows administrator no problem.If i login as user there the problem occures.        catch (Exception ex)        {            //ex.StackTrace;            //ex.Message;   ...

Activity log not logging any events
Hi i have installed the VBSDK kit and it is succesfully running but the activity log does not appear to log any activity, any help in this aspect would be greatly apreciated, Chris The activity log isn't heavily used in the CSK. Mostly it will only log errors related to sending mail or with web services and web service boxes. Generally, if you have no entries in there, it is a good thing.Stephen M. Redd http://www.reddnet.net...

Cannot do Database logging using Enterprise library Logging Application Blocks
Hello,     I am trying to build a custom TraceListener to do Custom DB Logging for our application. When I try to do Logging using the custom DB logger, loading the trace listeners throws an exception. The Exception is "The Value cannot be null or empty string. Parameter Name = name" This is happening while trying to call the Buildup method recursively in the Builderstrategy class. I think I do have my configuration right. I also have all the required Dlls in the bin folder. Cannot figure out what is happening. The same error happened while I was trying to use the existing ...

Log to multiple places with Logging Application Block 3.0
Hi I am just starting to research the Logging Application Block, as we want to implement it a new version of our application. One of the things we would like to be able to do is log something to more that one listener - like to the database and also send an email, or to the event log and also to the database. I have been perusing the documentation and forums but found nothing related to the scenario. Is this possible and if so are there any examples?Our environment is: Enterprise Library 3.0 ..Net Framework 2.0, ASP.Net, VB.Net Oracle (Implemented Data Access Application Block and it ...

Do unhandled exceptions get logged in the application event log by default ?
When your asp.net application has an unhandled exception, is there supposed to be an entry in the windows event log ?  No. Only ASP.NET errors that affect the worker process get logged by default. Website Design Darlington - http://mdssolutions.co.ukhttp://lessthandot.com - Experts, Information, Ideas & Knowledgehttp://aspnetlibrary.com - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer" on this post if it helped you Thank you.  Thats what I suspectedBy the way, anyone reading this post, here is a nice article on ...

Web resources about - ExceptionPolicy logs differently to event log than to text log - asp.net.application-block

Overview (Camel :: Core 2.15.0 API)
Overview Package Class Use Tree Deprecated Index Help Prev Next Frames No Frames All Classes Camel :: Core 2.15.0 API Camel API Package Description ...

Resources last updated: 12/24/2015 8:23:08 PM