Announcement Announcement Module
Collapse
No announcement yet.
AOP for Log4j Inbuilt API Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP for Log4j Inbuilt API

    Hello Friends,

    We are having some design clarifications in our project regarding AOP Implementation

    Requirement
    1. We have MDC feature of log4j implemented in our project,
    MDC.put is the method we are invoking to write mdc log, without AOP
    Now we were asked to do a webservice call inside that Put method
    [ either by overriding MDC class, or editing mdc source code in log4j and recompiling

    But we thought doing a AOP for this class MDC in log4j jar
    i.e
    Scanning for method pointcut MDC.put,

    Question
    1. Can we do aop for a class in log4j or any api.
    2. How to give target for such thing. i.e for a bean not declared in spring=beans.xml , how the target can be specified.


    Can anyone help us on this
    Regards

  • #2
    You will need a full blown AOP solution for this. In your case you need loadtime weaving you cannot do it by leveraging Spring AOP (that only operates on spring managed beans).

    Check the reference guide on how to enable loadtime weaving.

    Comment


    • #3
      Thanks

      Thanks for the Reply.

      I am not able to get concrete example. Can you guide me with some example

      1. MDC.put method i have to do AOP for
      2. TestAction is the class where i have called this MDC.put
      3. Now TestInterceptor is the advisor i am writing.

      Still not able to get about the value for the attribute target in ProxyFactoryBean definition

      Comment


      • #4
        Read the reference guide as I told you. You cannot use Spring AOP you MUST use loadtime weaving. So using a ProxyFactoryBean isn't going to help you.

        Chapter 6 explains the AOP solutions which work with spring and how to use the full blown aspectj loadtime weaving with spring.

        Comment

        Working...
        X