2896
Views
20
Comments
Setting Logging Level of a REST API

Since this topic comes up every once in a while, I decided to write a quick guide aimed at the beginner level on how to set the Logging Level of an Exposed or Consumed REST API to aid in debugging. This can be useful in case you need to see what's going on when e.g. the server reports an unhelpful "500 Internal Server Error", and you need to see what's going on.

1. Increase Logging Level

  1. Open Service Center of your server and log in.
  2. Chose "Factory" and "Modules" from the menu, and search for the right Module (the one consuming or exposing the REST API).
  3. Click the "Integrations" tab.
  4. Click on the name of the REST API below "Consumed REST APIs" or "Exposed REST APIs".
  5. Set "Logging Level" to "Full" (there's also "Troubleshoot", but I'm not sure about the differences with "Full").

2. Check the logging

  1. After you have consumed the REST API (either by running the application that consumes it, or running an application (or e.g. Postman) that consumes your REST API, again open Service Center (if it's not already open), and choose "Monitoring" and "Integrations" from the menu.
  2. Optionally filter for the Module that consumed or exposed the REST API.
  3. Click "Detail" (the very last column) after the entry you're interested in (note that "Detail" will not appear if you haven't increased the Logging Level).
  4. On the page that appears you can see what has been sent, and what has been replied. If there's more than about a page it's cut off, and you can press the "Download HTTP Trace" button to get a text file with the full trace. Note that in case of binary content, it will be encoded in Base64; to decode it google for "decode base64" and you'll find online tools to decode the data.

That's about it. In case of errors, look for signs that there's something wrong, e.g. missing data, missing authentication headers, malformatted data, etc. Note that by default, the Platform doesn't send data that has the default value, so be aware that depending on the values of the data you send, not everything may appear (which could also be the source of a problem if an external REST API expects this data anyway).

Davidk
Rank: #0

Very cool... thanks.

Champion
Rank: #209

It really helpful 

Thanks

Champion
Rank: #239

Kilian Hekhuis wrote:

Since this topic comes up every once in a while, I decided to write a quick guide aimed at the beginner level on how to set the Logging Level of an Exposed or Consumed REST API to aid in debugging. This can be useful in case you need to see what's going on when e.g. the server reports an unhelpful "500 Internal Server Error", and you need to see what's going on.

1. Increase Logging Level

  1. Open Service Center of your server and log in.
  2. Chose "Factory" and "eSpaces" from the menu, and search for the right eSpace (the one consuming or exposing the REST API).
  3. Click the "Integrations" tab.
  4. Click on the name of the REST API below "Consumed REST APIs" or "Exposed REST APIs".
  5. Set "Logging Level" to "Full" (there's also "Troubleshoot", but I'm not sure about the differences with "Full").

2. Check the logging

  1. After you have consumed the REST API (either by running the application that consumes it, or running an application (or e.g. Postman) that consumes your REST API, again open Service Center (if it's not already open), en chose "Monitoring" and "Integrations" from the menu.
  2. Optionally filter for the eSpace that consumed or exposed the REST API.
  3. Click "Detail" (the very last column) after the entry you're interested in (note that "Detail" will not appear if you haven't increased the Logging Level).
  4. On the page that appears you can see what has been sent, and what has been replied. If there's more than about a page it's cut off, and you can press the "Download HTTP Trace" button to get a text file with the full trace. Note that in case of binary content, it will be encoded in Base64; to decode it google for "decode base64" and you'll find online tools to decode the data.

That's about it. In case of errors, look for signs that there's something wrong, e.g. missing data, missing authentication headers, malformatted data, etc. Note that by default, the Platform doesn't send data that has the default value, so be aware that depending on the values of the data you send, not everything may appear (which could also be the source of a problem if an external REST API expects this data anyway).

It's really a valuable info..Thanks for sharing!!

Sachin


Rank: #139

Great stuff @kilian sir!!

Nice contribution!! Good Work!

Rank: #4560

Hi Kilian,

Thanks for this post!

May I know what performance issue will be caused by changing the Logging level to "Full"?


mvp_badge
MVP
Rank: #2

None, really. It's not adviced in production if you have large volumes of REST calls, and/or very large payloads, but on development and test you're pretty safe.

Rank: #10991

I cannot find eSpaces area now, 1/11/2019. It seems the interface design is changed

mvp_badge
MVP
Rank: #17

Pham Chinh wrote:

I cannot find eSpaces area now, 1/11/2019. It seems the interface design is changed

Hi, 

For Personal Environments Espaces is renamed to Modules in Service Center Factory menu.

Regards,

Daniel


mvp_badge
MVP
Rank: #2

Yes, it was renamed "Modules" in version 11, thanks Daniël for pointing it out. Unfortunately, I can't edit the original post.

Thank you so much for sharing knowledge.

Rank: #569

Kilian Hekhuis wrote:


2. Check the logging


4. On the page that appears you can see what has been sent, and what has been replied. If there's more than about a page it's cut off, and you can press the "Download HTTP Trace" button to get a text file with the full trace. Note that in case of binary content, it will be encoded in Base64; to decode it google for "decode base64" and you'll find online tools to decode the data.

Thanks for the valuable info, Kilian! That part about downloading HTTP trace is also important as the inner exception is usually not visible in the truncated error message in Service Center.


mvp_badge
MVP
Rank: #2

You're most welcome Ozan! Happy coding :)

Rank: #236

Stumbled upon this post while wondering the difference between "Troubleshoot" and "Full".

Here are the details from OutSystems documentation:

(https://success.outsystems.com/Documentation/11/Developing_an_Application/Troubleshooting_Applications/Troubleshoot_Service_Actions_Using_Logs#how-to-change-the-logging-detail-level-for-service-action)

The available logging levels for Service Action requests are the following:

Default
All requests are logged including some basic information (like the date and time of the request). No details regarding errors, request headers or payloads are logged.
Troubleshoot
On top of the information kept by the Default level, error details are also logged. Click on the "Error" link displayed on the right to get more details about the error.
Full
On top of the information kept by the Troubleshoot level, request headers and payloads are also logged. Click on the displayed "Error" link or, if there's no error, click on the "Details" link to obtain detailed logging information.

It seems to say "Troubleshoot" has "Full" logging for errors and "Default" for anything else.

mvp_badge
MVP
Rank: #2

Thanks for the addition Mikko. Though you reference a document for Service Actions, it's the same for REST and SOAP. For SOAP, the documentation is here, for REST, the documentation should be here but it's lacking, unfortunately.

Rank: #151

Hello Guys,

I have an HTTP trace that is not fitting in the txt:

(Consumed REST APIs)


<Message truncated in logging because it exceeded the maximum size>


Logging Level = Full:


Plataform Version 10.0.708.0 


How can i solve? 

is there any configuration to be done on the server or configuration tool so that the entire error message is displayed in the txt trace?


Regards and Thank you.


mvp_badge
MVP
Rank: #2

Hi Agno,

I haven't seen this before. It seems you are sending very large documents as base64 binary content, which might've triggered this. However, looking at the database table the data is stored, the Detail column has nvarchar(max), which shouldn't have a limit. I'll ask around to see if someone from OS has more information.


Rank: #151
Rank: #69222

Its really helpful!!!

mvp_badge
MVP
Rank: #2

Thank you, glad this old post is still useful :).