Logging

Logging

Old forum URL: forums.lhotka.net/forums/t/737.aspx


Bonio posted on Wednesday, July 26, 2006

Question is: should I be using logging in my CLSA BOs and if so can someone recommend a logging app? Or should I log errors only in the UI?

Advice greatly appreciated,

Bonio

vargasbo replied on Wednesday, July 26, 2006

I always place the logging outside my object. You should already be placing your "save()" calls in a try, catch, you might want to log that to an event logger, or a special db where you log user user's bug reports, whatever. You will however, what to inform your user that something unexpected did happen and how it could affect them, so forth.

RockfordLhotka replied on Wednesday, July 26, 2006

Make sure to differentiate between logging and auditing. The was a great thread on auditing a few weeks ago.

But if you want to do logging, I'd recommend pushing as much as you can into base classes. Business developers are often very bad at remembering to add logging code, but if it is in your framework it is hard to avoid Smile [:)]

What do you want to log? Data operations? Create a subclass of BusinessBase and override the DataPortal_OnInvoke and _OnComplete methods to record before/after data access info - stuff like that.

I personally like log4net. Many people like Microsoft's Enterprise Library. Yet others use the built in trace/log facility in .NET (especially in .NET 2.0, and even more especially in VB, because the My namespace wraps it very nicely). But log4net has been around and is very feature-rich, and I've found it to be quite good.

Bonio replied on Thursday, July 27, 2006

Hi Rocky

Primarily I am looking to log errors in a new application (most probably at data level). I will take a look at subclassing business base and see what I can achieve.

Thanks

Bonio

Copyright (c) Marimer LLC