Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

console app error trapping question

in a console application that will be run on windows scheduler, what's the best way to catch errors? I already implemented the try/catch idea, but i'd like to write to a file log rather than the console since i'll be running this on a schedule. what's the best way to log errors for a scheduled console app in .net 2.0?
0
acdagirl
Asked:
acdagirl
  • 3
  • 2
1 Solution
 
Bob LearnedCommented:
Look into log4net:

http://logging.apache.org/log4net/

You will get an awesome, free logging service that can write to files, databases, send emails, etc.

Bob
0
 
acdagirlAuthor Commented:
well i wanted to kind of do this/understand how to do this myself.
also i couldn't access any of the tutorials...
0
 
Bob LearnedCommented:
You can trap most errors with the AppDomain.UnhandledException, without any other exception handling routines, and use a single logging method to write to an event log/file/database, or email.

Bob
0
 
acdagirlAuthor Commented:
could you point me to an example of logging to an event log?
0
 
Bob LearnedCommented:
Write to the Event Log In VB.NET
http://www.freevbcode.com/ShowCode.Asp?ID=2298

Bob
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now