How To Log Binary Information

We can log binary information and sent it to a folder, a log, or a connector.
For each one of the options, we need to add the following to the application.yml:

ol: #Logging the request/response sent to the Backend# debug: internal: type: # the type of the log encoding: CP037

 

  1. Sending log binary information into a folder:

  • Add the following to your API project application.yml:

    ol: #Logging the request/response sent to the Backend# debug: internal: type: folder encoding: CP037 folder: C:\logs # the folder's path
  • After your API first call, you’ll find a folder named logs in the path you defined with the binary input and output.

 

2. Sending log binary information into a log

  • Add the following to your API project application.yml:

    ol: #Logging the request/response sent to the Backend# debug: internal: type: log encoding: CP037
  • After every API call, you would see binary information logs in your console.

     

3. Sending log binary into the connector:
ol.debug.internal.type will now allow setting the request-context. This will use Spring's org.springframework.web.context.request.RequestContextHolder to store the request and response debug information.
This will give you an object of type org.openlegacy.impl.debug.impl.http.InternalDebugHolder or null if nothing initialized it. In case of exceptions, or if it did not reach any point that set it (if there was no doAction on a provider that supports it for example), and you can access all the debug request-response pairs (org.openlegacy.impl.debug.impl.http.RequestResponseHolder) from the provider.

How to sent log binary into the connector:

  • Add the following to your SDK project application yml:

  • To get the context in your API, add the following to the service impl: