views:

1129

answers:

3

Are there any tutorials or sample programs out there on using AOP, Castle, and logging in a .Net application? I have found pieces out there but I am looking for something more to help me form a more complete picture.

Thanks, -Brian

+6  A: 

You need to be using a custom Interceptor, which inherits from IInterceptor. For example:

public class LogInterceptor : IInterceptor
{    
    public void Intercept(IInvocation invocation)
    {
        Logger.Write("I'm in your method logging your access");
        invocation.Proceed();
    }
}

Hopefully this helps.

jonnii
A: 

Hi jonnii,

Thanks for pointer. I am in the process of trying to implement logging over AOP. I'll post what I have once I have something working.

-Brian

Brian Lee
+3  A: 

Try this from Ayende's blog: http://ayende.com/Blog/archive/2008/07/31/Logging--the-AOP-way.aspx

nocache