feliperochadev / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Logging contextual information and log to multiple sinks via configuration. #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Two issues
===========
1) When an error is logged, I want to add contextual information to help in
debugging the error.
For e.g. whenever there is a SQLException while executing a stored
procedure, I generally log the database connection string (without
credentials), sp name, sp parameter names and values etc. I have other
"state" which I want to dump to the log too.

2) I want to log an exception to multiple sinks based on severity of the
exception. I am thinking along the lines of the Logging Application block
configuration - where you can attach multiple listeners based on logentry
category.

Solution I am thinking off
==========================
1) Create an Interface for this purpose. Make sure all custom exceptions
(in all web apps in the company) implement this interface. This interface
will have two read only public properties ( severity and IDictionary). I
decided on dictionary with basic types (string), so that it is easy to
deserialize the Elmah "Error" object.

2) At run time the developer creates an instance of the dictionary and logs
the required state in the dictionary as key, value pairs.

3) At run time set the priority property to appropriate value. Most
probably create an Enum list (high, low, medium etc.)

4) Throw the custom exception.

Now, what is the best way to implement the functionality in ELMAH. My thoughts:

Create some sort of configuration schema in web.config, read it in a new
HttpModule object and send the information to multiple sinks

In the Error class, read the IDictionary object and create XML element for
each key value pair.

Thanks
Arvind

Original issue reported on code.google.com by asheri...@yahoo.com on 12 Oct 2007 at 5:21

GoogleCodeExporter commented 9 years ago
Hello, I added this issue as a defect, when really it is an enhancement. Please
change the "type" of the issue.

Arvind

Original comment by asheri...@yahoo.com on 12 Oct 2007 at 5:23

GoogleCodeExporter commented 9 years ago
When I thought about this further, the interface idea won't work unless the
interface, priority enumeration class is housed in the Elmah assembly.

Original comment by asheri...@yahoo.com on 12 Oct 2007 at 5:35

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 13 Oct 2007 at 10:15

GoogleCodeExporter commented 9 years ago
Another type of contextual information that I would like to log is information 
that
would allow identification of the specific user using the application at the 
time
that the error occurred.

Original comment by BCaseyHa...@gmail.com on 6 Nov 2007 at 6:34