Logging/error handling

  • Thread starter Thread starter Jeffrey
  • Start date Start date
J

Jeffrey

There is a small group of doing .net development in c#/VB.net. I noticed
each of us is logging/ catching errors differently in our programs. In
short, does anybody know of a class or object out that that will allow us to
add to each project to have common logging/error handling to access through
each program. Not sure if anybody has written a class that handles errors
and logging. Any help is appreciated

Thanks!
 
The way I've always approached this is to use a minimalist exception
handling paradigm (only when I need to) but always have a
'ThreadExceptionEventHandler' to be the catch all. In all of my exception
handlers (including the catch-all), I log the exception (which contains a
full stack trace at the time of the exception) to a log file in the
application directory using Log4Net. There are many ways to do logging, but
Log4Net has treated me very well so far, so I have no reason to change.
Log4Net allows you to log to just about anywhere: file, event log, ... and
is configurable via your app.config file. It also allows for levels of
logging, which you can modify by modifying the app.config file. You can see
how this could be beneficial with applications that are producing problems
"in the field".

A side note if you're interested: if you do write a file to the application
directory, and the app can be used by users with minimal rights, make sure
the directory structure of the application can be written to by these types
of users. We designate this to the installation of the app.
 
Hi Jeffrey,

I think WineNCheese has provided you a detailed reply for general exception
handling. Actually, there is a good article writen by Jason Clark which
should make sense for you, please refer to:
"Unexpected Errors in Managed Applications"
http://msdn.microsoft.com/msdnmag/issues/04/06/NET/
=====================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top