Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-02-06
5
Medium Priority
?
322 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 …
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
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 how to clear a vector as well as how to detect empty vectors in C++.

670 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