Solved

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

Posted on 2013-02-06
5
298 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Where did System.Data.Objects go? 2 27
Hey!! 5 33
Math Equation 23 87
How to convert Structure to vector of byte and vice versa 5 15
This is about my first experience with programming Arduino.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

777 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