Go Premium for a chance to win a PS4. Enter to Win

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

c# - decide later on what to do with errors + error reporting

Hi Experts,

I'm trying to think of a nice way in C# to have the user set the control of where errors happen.  For instance- I know that if we write to the console- the console can be re-routed to another stream- perhaps a file?

I'd like any ideas I can get on error reporting for c# (and c++ too)

Thanks a lot for your help!
Mike
0
thready
Asked:
thready
  • 3
  • 2
1 Solution
 
jkrCommented:
So you're basically after a logging library? Take a look at log4cpp (http://sourceforge.net/projects/log4cpp/) or log4cxx (http://logging.apache.org/log4cxx/index.html) and it's .NET sibling log4net (http://logging.apache.org/log4net/).
0
 
threadyAuthor Commented:
Not really- I have lots of different logging libraries...  I'm more looking for tips and tricks I guess..  Let's say you have a function that does X.  When something goes wrong, you don't necessarily just want to write it to a file- you might want to "temporarily redirect" the writing to a console - to another location- maybe a memory location- then you could pop it up in a window....

Maybe logging is the best way - just looking for other ideas and maybe better ways of handling errors.
0
 
threadyAuthor Commented:
To elaborate a bit more- I could add a debug version of " show verbose errors" through a checkbox - and instead of messages going to the console-  they'd go to another popup window....

Or maybe better ideas....
0
 
jkrCommented:
Well, that's the "logging level" that these libraries offer, where messages are dropped unless they are critical.. One handy way to control that is e.g. setting this treshold either as an environment variable or some registry entry, so you can easily change that and restart the app in question to obtain more diagnostic output.
0
 
threadyAuthor Commented:
Yeah ok.... Guess I was getting a little too creative...  :)  Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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