tags:

views:

661

answers:

9
+3  Q: 

.Net 3.5 Logging

I'm a pretty new C# programmer. I was wondering if someone can fill me in with more information on how to use a logging Framework into a already existing solution (if that's what you call it).

I am trying to get logging for my Project i am doing. I was wondering what good & easy frameworks there are and how are they supposed to be implemented? Should I research a specific topic? I haven't found much tutorials or anything. So if anyone has any suggestions or ideas that can lead me to the right way. I would really appreciate it.

Also Just wondering. I am using .Net 3.5 Since Log4Net is using .Net 2.0... Is there any conflicting/ will it slow it down or anything?

A: 

I use NLog for the moment.

It works great because you can output to almost any type of medium (database, file, messagebox, networkshare, console, etc etc) by just adjusting a xml file with settings.

It has also a lot of other nice features (log message levels like debug, info, error, etc). Just google for a comparison with other frameworks.

The only bad this is that is doesnt support aspect oreiented programming, so you have to put manual .Log() statements everywhere in the code.

Henri
+7  A: 

A very good logging framework, which allows for quite a bit of flexibility and easy integration, is Apache's log4net. It is nice in that it allows easy configuration of multiple, independent logging targets.

(The official site seems to be down - wikipedia has a good discussion about log4net.)

Reed Copsey
A: 

You could try log4net or the logging application block from Microsoft Enterprise Library.

Satish
+1  A: 

I would recommend log4net together with Common Logging. The latter allows you to plug in either log4net or the Microsoft Enterprise Library logging implementations.

Vinay Sajip
A: 

HTTPModule and your own function to spit it to a logfile/db. Works for me.

madcolor
A: 

I use (and write and maintain =D) the SixPack library, which includes a very easy to use logging framework. Example:

using SixPack.Diagnostics;

///

  Log.Instance.Add("Hello");

///
Sklivvz
A: 

If you are working with asp.net or asp.mvc you can try ELMAH. It is really nice and just plugs right into your website. Granted ELMAH only handles errors, and if you have more you want to log, I would use it in part with another logging framework. I tend to mix it with Log4Net.

dionysus55
A: 

Take a look at GIBRALTAR. It's a great logging tool that combines the goodness of ELMAH, log4net, perfmon and other tools in one very nice package. It works for desktop or ASP.NET applications and is very easy to integrate.

DISCLOSURE: I'm biased. I've been writing logging tools for 10 years and spent the last two years along with the other members of my mISV writing Gibraltar.

For a quick peek, check us out on YouTube.

Cheers, Jay Cincotta

Jay Cincotta
A: 

To focus on this part of your question...

Also Just wondering. I am using .Net 3.5 Since Log4Net is using .Net 2.0... Is there any conflicting/ will it slow it down or anything?

No, there will be no conflict. .NET 3.5 is simply a superset of .NET 2.0. Applications written for .NET 3.5 will happily run using .NET 2.0 third party libraries (e.g. it is 100% compatible).

Ray Hayes