API Connect

 View Only

Quick Answer: Easiest way for an APIM Developer to get DP Logs

By Morris Matsa posted Thu December 24, 2020 10:30 PM

  

Quick Question:

What is the easiest way for an APIM developer to get the DP logs from a test transaction?

This question usually comes from DataPower developers who hit their first bug with APIC and want their tried-and-true access to DataPower logs to debug and fix their API.

The Question

APIC allows an API Developer to easily develop an API, including an Assembly full of diverse capabilities, without needing to explicitly configure any DataPower objects.  This makes it easy to design and author the enforcement of your API.  As you work on how the API will actually respond to requests, you try it out — in APIC v10 you try it in the API Manager's new Test Tab.  When it all works and you get the result you're expecting, you're happy.

How about when it doesn't give the answer that you were expecting?  That's where the new Assembly Debug feature comes in.  It shows you which path through your assembly was taken, and offers details on what happened at each stage along the way.

Assembly Debug Trace

If you are an old DataPower user, then even before you hit your first bug you're probably considering logging into DataPower's WebGUI to see the DP logs.

There are several ways to see those logs.  What is the easiest way when you're testing in the API Manager's Test Tab?

Explanation

The good news for you is that by the time you ran the test transaction in the Test Tab, the new Assembly Debug feature already grabbed the logs for you.  While these are the same DataPower log messages that you're used to, there are some important differences:

  • Test Transaction: These are the logs exactly for your one transaction.
  • Only Transaction Logs: They do not include logs which are not for your specific transaction, even if those messages happened at the same time.
  • All Log Levels: They are all logs, all the way down to debug log level, regardless of which logging level was set on the gateway.
  • All API Developers: Every API Developer who has access to develop and test their API in the API Manager can get these logs that are specific to their test transaction. 

The Answer

After you've run the test transaction on APIC v10's Test Tab, follow these simple steps:

1. Scroll down below the trace and select Full Trace and enable Advanced:

Choice of which trace details to view, we choose Full trace and Advanced

2. Use your browser to search for the key defaultLog.

defaultLog in debug trace with the first few log messages

3. I recommend cut-and-pasting the logs from here into an editor that lets you find-replace-all to add the newlines, and optionally remove the timestamps or skip any lines with certain patterns.  You can use sed and grep, or a full IDE.  Please let me know which features you use to investigate your DP logs, and any enhancement requests.

That's it! 

Note: These pictures are from APIC v10.0.1.1, earlier and later versions might have differences in the UI, but you get the idea.


#apic
#APIConnect
#apigw
#DataPower
#DataPowerGateways
#debug
0 comments
42 views

Permalink