Newbie: Log4Net or MS Logging Application Block?

Topics: Logging Application Block
Oct 22, 2007 at 11:38 AM
Hello all,
I have been asked to compare the Log4Net library with the Microsoft patterns & practices Logging Application Block.

I have searched this forum but can't find anyone who has asked this question previously. I would have thought this is a common topic.

Does anyone know if this type of side-by-side comparison has been done? I know that both are very extensible, but I am interested in comparing the core deliverables. In particular, I am interested in using either for both Logging and Auditing purposes.

Audit will require transactions, which is to say that the calling code needs to know if the Audit message has been persisted or not before it can continue, which I guess is something similar to http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=16465


Cheers,
Steve

Oct 22, 2007 at 11:50 AM
I found this article http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=10534, but I would be interested in hearing some real-world examples of why people choose EAB over Log4Net.

Currently, my project has no plans to use any other block, but we could possibly see using WCF or WWF at some point, if that matters.
Oct 22, 2007 at 2:41 PM
I just recently went through this excersise myself and came to the conclusion that enterprise library was a better fit for what we are trying to do. I found Enterprise Library much easier to work with a custom database table for logging than Log4Net (we want to route different information to different tables based on category). Also, we plan on using WCF and some of the newer technologies from MS in teh future and Enterprise Library is a better fit. The Enterprise Library configuration tool made it very easy to modify the config file instead of manully having to modify it like Log4Net. The last Log4Net release was a long time ago and I believe you can expect more frequent updates and features from Enterprise Library.

If there are specific things you are looking at for comparison let me know and I can dig out my notes.

Joe

Oct 22, 2007 at 3:00 PM
Thanks Joe, thats just what I was thinking.

We are looking to use the category to decide if a log message is just log information or audit information and take appropriate action.

As mentioned, for auditing, we will need to ensure that the message reaches the final destination, which is likely to be a DB, but may be an MSMQ. Did you work out if both framework provide this type of control out of the box?

Cheers,
Steve
Oct 22, 2007 at 7:33 PM
We are working on creating WCF service for logging with msmq end point. I think it is pretty cool and fits well Enterprise Libraries instead of using Log4Net.

Cheers.



jjoravec wrote:
I just recently went through this excersise myself and came to the conclusion that enterprise library was a better fit for what we are trying to do. I found Enterprise Library much easier to work with a custom database table for logging than Log4Net (we want to route different information to different tables based on category). Also, we plan on using WCF and some of the newer technologies from MS in teh future and Enterprise Library is a better fit. The Enterprise Library configuration tool made it very easy to modify the config file instead of manully having to modify it like Log4Net. The last Log4Net release was a long time ago and I believe you can expect more frequent updates and features from Enterprise Library.

If there are specific things you are looking at for comparison let me know and I can dig out my notes.

Joe



Oct 22, 2007 at 8:43 PM
In fact, since we have a factory based on the WSSF Modeling Edition that uses NHibernate as the OR mapper, we have to use both. To get all logging at the same place, I created a simple NHibernate Appender that forwards all logging to an EntLib logging handler. However, I must admit I prefer the interface provided by Log4Net since it is easier to use and to configure. I actually created an EntLib configuration so that the levels (info, warn, debug, etc.) closely match those of log4net.

Dennis Doomen
Oct 23, 2007 at 8:57 AM
So the Logging Application Block (LAB) is synchronous by default, right?

That suits my need to write audit data. For logging data, I was looking at async comms. Is the best practice to achieve this through posting onto an MSMQ and pulling the messages off the queue as and when required? What are the performance implications of this?

I guess that the listener at the end of the MSMQ could simply use another configuration of LAB and post messages into the Logging DB (or any other sync), but I have concerns over the APP-MSMQ-SYNC performance model, unless I have it all wrong!!!