loggingenterprise-librarymarshalbyrefobjectpolicy-injection

Logging using policy injection application block


Hi All

I want to ask, how to use policy injection application block to log methods entry and exit in these cases :

Case1 : in case of logging events handlers of a web form controls, you know the class let's say _Default must be inherited from class System.Web.UI.Page , so we can't inherit our class from MarshalByRefObject class so logging will not work.

Case2 : in case we have a static class and we have to log the methods within, what we can do to inherit this class from MarshalByRefObject calss, in order to get logging works.


Solution

  • It sounds to me like they have some stupid requirements to be able to apply logging... This may be an offtopic, but you might want to look at Spring.AOP framework to apply logging to your objects without the need to inherit from MarshalByRefObject. (In multiple-inheritance-amputated languages it is an annoying and drastic requirement I think).