-
Method Logging using AOP in ASP.NET 4.0
Hello,
I want to intercept every method call inside my ASP.NET application (and also the assemblies it uses) for certain methods that have a custom Attribute on them. I am doing this using two attributematch method pointcut advisors and a DefaultAdvisorAutoProxyCreator. My config looks like this:
<spring>
<context type="Spring.Context.Support.WebApplicationContext , Spring.Web">
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object type="~/Default.aspx">
<!--<property name="Message" value="Hello from Web.Config"/>-->
</object>
<object id="log4NetAfterAdvice" type="Logging.Log4NetAfterAdvice"/>
<object id="log4NetBeforeAdvice" type="Logging.Log4NetBeforeAdvice"/>
<object id="SampleClass" type="Logging.SampleClass"/>
<object id="InterceptedMethodBeforeAdvisor" type="Spring.Aop.Support.AttributeMatchMethodPoint cutAdvisor, Spring.Aop">
<property name="Advice" ref="log4NetBeforeAdvice"/>
<property name="Attribute" value="Logging.InterceptedMethodAttribute"/>
</object>
<object id="InterceptedMethodAfterAdvisor" type="Spring.Aop.Support.AttributeMatchMethodPoint cutAdvisor, Spring.Aop">
<property name="Advice" ref="log4NetAfterAdvice"/>
<property name="Attribute" value="Logging.InterceptedMethodAttribute"/>
</object>
<object type="Spring.Aop.Framework.AutoProxy.DefaultAdviso rAutoProxyCreator">
</object>
</objects>
</spring>
For some reason, the advisors do not work for the methods in the page Default.aspx that have the attribute, but if I do another thing with spring.net, like setting a property for instance, it works fine.
How can I achieve this?? I am quite new to IoC and DI, so please forgive me if this is a stupid question :P
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules