7

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

benPearce
  • 37,735
  • 14
  • 62
  • 96
Brian Lee
  • 71
  • 1
  • 3
  • 1
    Try this from Ayende's blog: [http://ayende.com/Blog/archive/2008/07/31/Logging--the-AOP-way.aspx](http://ayende.com/Blog/archive/2008/07/31/Logging--the-AOP-way.aspx) – nocache Nov 03 '08 at 03:52

1 Answers1

8

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
  • 28,019
  • 8
  • 80
  • 108