As you build more sophisticated flows in IBM App Connect, you might want to see what the flow is doing when it runs.

Maybe you’ve got questions like:

  • Which path did my flow go down?
  • What data was returned from the SaaS application?
  • When my custom HTTP request returned 400¬†Request what error message came back?

You can answer these questions by using the IBM Cloud Log Analysis service together with the IBM App Connect service on IBM Cloud.

 + 
Service tiles in the IBM Cloud catalog. (Click an image to open the service tile in the catalog.)

IBM App Connect sends your log messages to the IBM Cloud Log Analysis service which provides a rich toolkit for filtering and visualizing your logs – based on Kibana.

Use the menu in IBM App Connect to open the log viewer, a pre-configured Kibana dashboard showing the logs from your App Connect instance.

Using the menu in IBM App Connect to open the log viewer.

If you don’t see the menu option, make sure you have¬†provisioned your instance of IBM App Connect on IBM Cloud. You can create a Lite instance for free.

App Connect log levels

The types of log entry emitted by IBM App Connect flows are as follows:

  • error¬†– emitted when a¬†trigger, flow logic or action fails
    • Logged to the built-in¬†viewer available on the flow tile on the dashboard, and¬†IBM Cloud Log Analysis
    • Enabled by default
  • info – emitted¬†at key points, such as when a flow is triggered, or completes successfully
    • Logged only to IBM Cloud Log Analysis
    • Enabled by default
  • debug – detailed information about the execution of flows, including payload data
    • Logged only to IBM Cloud Log Analysis
    • Enabled manually¬†– a restart of your Event-driven Flow or API is currently required to enable debug logging

To enable debug logging for a flow, from the flow tile’s menu (⋮) on the Dashboard select Enable debug logging, and then restart your flow.

Using a flow tile’s menu to enable debug logging for a flow.

Debugging a flow

When debug logging is enabled, you will see a log entry output from each step in the flow that executes successfully. The log entry includes the output data from that step (in JSON format). In App Connect, each step in the flow has access to the output from all previous steps; you might have noticed this when building your flow.

Let’s have a look at¬†how¬†to¬†use the debug entries from each step to¬†diagnose¬†a failure in the flow.

I have a flow that retrieves a Case from Salesforce in a “Salesforce Retrieve Case” step and then invokes a POST to an IBM Cloud Functions API in an “HTTP Invoke method” step.

Example flow with a “Salesforce Retrieve Case” step followed by an “HTTP Invoke method” step. (Click image to view full size.)

However, when I invoke the API I get an error. I need to diagnose what’s going wrong, so I enable debug logging and then open the log viewer.

To see messages for the error, after enabling debug logging I invoke the API again. (The log viewer will only show new messages logged after debug logging has been enabled.)

In the ‘Selected Fields’ section, I select loglevel_str, message¬†and detail_str¬†to be columns in my view.

The log viewer showing messages from “Salesforce Retrieve Case” and the call to my IBM Cloud Functions¬†API. (Click image to view full size.)

The fact that I am getting ‘400 Bad Request’ back from the API, suggests to me that I am sending the wrong data. So I look for the detail of the log entry that describes the full data sent to the IBM Cloud Functions action.

Detail of the log entry that describes the full data sent to the IBM Cloud Functions action. (Click image to view full size.)

I can see the data {"payload": "erm"} was sent to the action, and looking back at my flow I can see this is built up from the Subject in the Salesforce Case object.

So I open up the response of the “Salesforce Retrieve Case” action, and check the subject.

Detail for the response of the “Salesforce Retrieve Case” action. (Click image to view full size.)

I go into Salesforce, correct the record to have the right value, and invoke my API again to re-run my flow successfully.

Then I inspect the results.

Messages after making corrections and rerunning the flow successfully.

So that’s it. I have got my flow working, and I can disable debug logging for the flow. (From the flow tile’s menu (⋮) on the Dashboard select Disable debug logging, and then restart your flow.)

Finding out more

Kibana is a powerful tool, and you might want to spend some time learning its features for filtering and visualizing logs.

If you find that the amount of logging available in IBM App Connect is insufficient to diagnose a particular problem, please talk to us.

We want to help you get to the bottom of your problem, and we want to take opportunities to improve the debug log entries in the product so that you can solve your problems more easily.

Just ask a question on our forum.

Join The Discussion

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