Announcement Announcement Module
Collapse
No announcement yet.
Logging advice: wire-tap or AOP logging? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logging advice: wire-tap or AOP logging?

    Hi there,

    I've written a Spring Integration (ws-inbound-gateway) application and would like to improve it's logging, which I am currently doing inside each service activator class using log4j.

    What would be considered best practice? Logging with wire-tap or AOP logging? (I'd need to get familiar with both, so no preference.)

    Thanks,
    Alex

  • #2
    Hi, Alex!

    In general both approaches play different role:
    Wire-Tap has more wider perspective, it doesn't stop only on <logging-channel-adapter>. From other side Wire-Tap is an interceptor, who sends incoming message to the channel to its configured channel to start some other flow. So, if you want just to logging you messages you'll see logs only about message before your services. And if you rely on 'replay-channel' from message headers, you cound not see in logs messages after your services.

    And now about AOP.
    Spring Integration has an 'request-advice-chain' ability. So, you can write simple LoggingAdvice via implementation of AbstractRequestHandlerAdvice. In this case you can simply 'advice' you services to see logs of their work, as well about incoming message, as about outbound results.

    Hope that is clear,
    Artem

    Comment


    • #3
      Thanks Artem. Based on what you've written, I'll give AOP logging a go.

      Cheers,
      Alex

      Comment


      • #4
        I'm trying both.

        Actually, I'm using custom beans as channel interceptors, instead of wire-tap, because I want some kind of formatting in the logging. But it's the same case.

        I'll let you know how they work.

        Comment

        Working...
        X