Improving Error Handling/Tracing

Soldato
Joined
27 Mar 2003
Posts
2,710
Right not sure where this thread will go but here goes.

I have been working with .Net for a number of years now and everyday with it is brilliant I seem to be learning new stuff all the time which is great in one way but bad in others. (had tried to use new stuff that wasn't appropriate for the task but because I had learnt it I wanted to put to use. I am sure we have all been there.) Anyway I have been working on a little project to help me improve my basic design and implementation and build up some class libraries that I can use on multiple projects rather than having to build things from scratch or nab bits of code from previous projects.

So after reading/still reading design pattern books and realising I was doing somethings well and others not very well (from a coding perspective) I have gone to the drawing board with a project that I finished a year ago and am looking at ways to improve it.

Now one of the main failings is error handling/logging so I want to develop a system that will be extensible enough to be able to write to various sources ie, email, sql, event logs, xml files, tracing etc.

Now that I have the idea in my head that this needs to be done I am trying to think of the best way to implement it. So was wondering what others have done

My intention is to write this thing once and then reuse it but allow it to be extensible enough that should some new feature come along that helps with error handling/tracing/logging I can just plug it in without it breaking anything else that I have this hooked into.

I guess I am trying to really bounce some ideas rather than get actual coding examples.
 
Right not sure where this thread will go but here goes.

I have been working with .Net for a number of years now and everyday with it is brilliant I seem to be learning new stuff all the time which is great in one way but bad in others. (had tried to use new stuff that wasn't appropriate for the task but because I had learnt it I wanted to put to use. I am sure we have all been there.) Anyway I have been working on a little project to help me improve my basic design and implementation and build up some class libraries that I can use on multiple projects rather than having to build things from scratch or nab bits of code from previous projects.

So after reading/still reading design pattern books and realising I was doing somethings well and others not very well (from a coding perspective) I have gone to the drawing board with a project that I finished a year ago and am looking at ways to improve it.

Now one of the main failings is error handling/logging so I want to develop a system that will be extensible enough to be able to write to various sources ie, email, sql, event logs, xml files, tracing etc.

Now that I have the idea in my head that this needs to be done I am trying to think of the best way to implement it. So was wondering what others have done

My intention is to write this thing once and then reuse it but allow it to be extensible enough that should some new feature come along that helps with error handling/tracing/logging I can just plug it in without it breaking anything else that I have this hooked into.

I guess I am trying to really bounce some ideas rather than get actual coding examples.

Logging framweork - i.e. Log4J - http://logging.apache.org/log4j/1.2/
 
Thanks for the suggestions.

I am not dismissing these frameworks outrightly but I am more interested in developing my own solution.

I know this is probably reinventing the wheel somewhat but I would rather develop something that fits my needs rather than having to work with a framework that initially works well for me but later turns out it doesn't do something that I need it to do. Where as if I develop my own "framework" then I can customize and add to it as I go.
 
I know this is probably reinventing the wheel somewhat but I would rather develop something that fits my needs rather than having to work with a framework that initially works well for me but later turns out it doesn't do something that I need it to do. Where as if I develop my own "framework" then I can customize and add to it as I go.

Honourable intentions, no doubt, but when things like Elmah are widely used and very thoroughly tested, as well as highly extensible, I honestly think you'd be better off putting your energy into something else :)

Just my 2p!
 
Kinda prefer NLog to log4net now, it's a bit more streamlined and apparently faster.

OP Log4Net and NLog are really worth using as a massive amount of time has been put in to make them work very well with minimal impact on performance, you could always look to extend one of them if it didn't do what you need.
 
Well have had a bit more of a look at the frameworks that have been suggested and although they kinda do what I want I still think I would be better developing my own solution.

The reasons are as follows:

1) I think this could be a really good training tool for me to improve my coding and put some of the design theory to use.
2) I can sit down and actually think about what error logging actually is and how it should be used in my applications both windows and web based.
3) Build something that I have complete control over.
4) Produce something that others could try and integrate into their own applications.

I may use the current frameworks as a point of reference but I think I have a fairly clear idea of what I want to do.

Although I have coding as a profession for a couple of years it is staggering even now how much I am learning. When I think back over the last 6 years of coming from basically no understanding of .Net, SQL, CSS, HTML and JavaScript/JQuery to where I am now it is amazing. Although I know I have gaps in my knowledge with even some of the basics of each of the languages I am planning to try and close the gaps on these over the next 12 months both via personal projects and work based projects.

I also think this would be a good project to probably blog about. It may not be entirely interesting stuff to read but it would give me the continued push to see this through to the end.
 
Ok so have started some of the ground work on setting this project up.

I have also decided as part of this to try and use a TDD (Test Driven Development) as this could help me in defining and testing my code fully.

So I have set up a basic project and defined a couple of basic interfaces and base classes.

I will expand on the structure of this later as it is still fairly raw at the moment.

I have also started a blog in case anyone is interested but will keep this thread updated with developments as I am sure to get peoples views/help with things.

So thanks in advance to anyone that can help.
 
Back
Top Bottom