This post show Groovy scripting to read and log all header, properties in message log, and payload body as attachment, then can be viewed in Monitoring Message Processing Log, for troubleshooting and debug purpose.
Reuse previous iFlow, the completed iFlow is like below. Added 2 steps before and after message mapping step, name it log01 and log02 respectively.

Create script called logger.groovy:

At log01 and log02 steps, put value in Name and Script Function as well:

After test run, will able to see 2 attachments:

All header and properties is showing at “Log” tab:

Attachment are showing and 2nd and 3rd tabs:

Keep on exploring 🙂

Debug/Logging Headers, Properties, Payload Body using Groovy Scripts
Tagged on:             

2 thoughts on “Debug/Logging Headers, Properties, Payload Body using Groovy Scripts

  • April 12, 2019 at 5:02 am
    Permalink

    Hi..
    Using the above steps, the attachment is generated in an iFlow, however, when we try to access it gives the below message

    “Request for log attachments failed with error: Invalid server response: Couldn’t parse message.
    Status Code: 500
    Message: Internal Server Errorwhile trying to invoke the method java.io.InputStream.read(byte[]) of a null object loaded from local variable ‘is'”

    any thoughts on why it throws the above error?

    Reply
    • January 13, 2020 at 1:11 pm
      Permalink

      Hi Virendra,

      Even we are facing the same issues. Were you able to solve it. Your response will be of great help.

      Thanks,
      Sowmya

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *