Solved

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

Posted on 2013-02-06
5
288 Views
Last Modified: 2013-02-06
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
Comment
Question by:thready
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 38861493
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
 
LVL 1

Author Comment

by:thready
ID: 38861519
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
 
LVL 1

Author Comment

by:thready
ID: 38861530
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
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 38861545
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
 
LVL 1

Author Closing Comment

by:thready
ID: 38861552
Yeah ok.... Guess I was getting a little too creative...  :)  Thanks!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now