Solved

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

Posted on 2013-02-06
5
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Part One of the two-part Q&A series with MalwareTech.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

636 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