Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

Logging/error handling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeffrey - 19 Jan 2005 13:33 GMT
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!
WineNCheese - 19 Jan 2005 19:02 GMT
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.

> 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
[quoted text clipped - 6 lines]
>
> Thanks!
"Jeffrey Tan[MSFT]" - 20 Jan 2005 02:26 GMT
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
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.