.NETGURU
Logging Exceptions ... Where ?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Gurminder (VIP)
Hi,
Can anybody guide which approach is the best for logging exceptions ?
The solution should consider performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

Logging Exceptions to,
1. Text Files
2. SQL Server
3. MSMQ
or, suggest any other ...

Regds
Gurminder

Reply to this message...
 
    
Raghavendra T V
Hi Gurminder,

I would suggest you to log errors in the System EventLog.
Logging errors to event log is faster than logging errors to a text file.
But if you application is yet to be deployed to production server.
I would suggest you to go for logging errors to text file and once you are
done with fixing
regularly occuring errors you will be limiting the errors that will be
logged to the text file.
then you can move the error logging to the System Event log.

Final conclusion: System Event logging is the best recommended if you
consider Performance, concurrency issues, production
scenarious, easy of data analysis & purging operations.

and also you have various 3rd party , some free tools for analysing the
system Event logs.

[For you knowledge: you can read the Microsoft - Improving .NET Application
Performance and Scalability.pdf ebook published by microsoft which
is available for free download . This book clearly mentions how to log
errors and where and which is the best one to go for.]

you can download the book from here.
http://www.microsoft.com/downloads/details.aspx?FamilyId=8A2E454D-F30E-4E72-B531-75384A0F1C47&displaylang=en

Thanks
Raghavendra

"Gurminder" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Gurminder (VIP)
Thanks Raghavendra.

But, I would like to add that we are not considering event log because, in
production sceanrios, event logs can often go full and also in mulitple
application scenario, mangaing those become a headache.

"Raghavendra T V" wrote:

[Original message clipped]

Reply to this message...
 
    
David Levine
You can define your own backing store for the event log to reduce the
possibility of filling it up. Any logging you do has the potential of
overruning the store.

"Gurminder" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Raghavendra T V
Hi Gurminder,

Since you are saying that the log might get filledup you can also move the
contents of it to a backup file once it is full and notify the developer
through some mechanism.

Also have a look at the Microsoft Exception Management Block.
You can download it from the following link
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=8CA8EB6E-6F4A-43DF-ADEB-8F22CA173E02

Its a 600 Kb file

This gives you the option of logging errors into
-> System eventlog
-> Email notification ( error through email )
-> Database ( logging into database )

may be you can use a mixture of this depending on the scenario.

Also have a look at this
http://www.c-sharpcorner.com/ExceptionHandling.asp

interesting article to read on logging errors.
http://www.c-sharpcorner.com/Code/2003/Sept/CustomExceptionsUsingMSExpBlock.asp

Hope all this helps you in designing a better error logging mechanism.

Thanks
Raghavendra

"David Levine" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Nick Malik
In addition to the Exception Management Application Block, have a look at
the Logging Application Block.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/Logging.asp
This uses the Enterprise Instrumentation Framework (EIF).

This is a more robust logging architecture. While it is still capable of
logging to the event log, if you want to use it that way, the Logging
Application Block can take configurable adapters to log to anyplace you'd
like (flat files, SQL Server, TCP messages, whatever). In addition, if a
log is not available, it can be configured to use a backup location.

It takes a little more work to use, but it is worth the effort if you really
want a fully thought-out logging solution.

--- Nick

BTW, Event logs can be configured so that they will discard old messages
rather than reject new ones. Also, you can set up your own event log to log
events from your application, making it easy to manage. I think this is
what Raghavendra was trying to say...

"Raghavendra T V" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Trilok Khairnar
Also look at http://logging.apache.org/log4net/

Regards,
Trilok.

"Nick Malik" <Click here to reveal e-mail address> wrote in message
news:6eeZc.5971$3l3.4433@attbi_s03...
[Original message clipped]

Reply to this message...
 
 
System.Diagnostics.EventLog




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification