Step by Step with the SAP Cloud Platform SDK for Android
Part 12 — Server Logging and Tracing
The below examples will modify the server’s log levels to log more information, record a server trace, and demonstrate how to use Fiddler to view the recorded trace.
Change Log Levels
Record a Server Trace
Use Fiddler to View the Recorded Trace
The log level of the Offline component of Mobile Services will be changed to the debug log level and events will be included in the log.
- In the SAP Mobile Cockpit, select Settings > Log Settings.
- Under Component Settings, change the log level the Offline component to DEBUG, check Event Logs and press the Save button.
We should now see more information about the Offline component when it is used by the app.
- In the app, tap the Sync button.
- Go to Analytics > Logs.
Notice that the event log is available from the Sync operation as shown below. Note it may take a few minutes for the logs to appear.
The debug logs for the offline component are available under the Technical Logs tab.
In this step, a trace of the server’s network calls will be recorded during a sync.
- In the Mobile Cockpit, go to Analytics > Network Traces and click Start Recording.
- Go to the app and tap on the Sync button.
- Click on Stop Recording.
- Under the Download section, set the Download Type to HAR and click Download.
Now that the trace has been recorded, it can be viewed in Fiddler.
- In Fiddler, go to File > Import Sessions…, set the dropdown menu to HTTPArchive and press Next.
- Select the downloaded file and press Open.You should see the server’s request made to the backend due to the mobile app’s sync request.
Note that products is being requested as that was the entity that was specified in the method setupOfflineOData in the below line.
OfflineODataDefiningQuery myDefiningQuery = new OfflineODataDefiningQuery("Products", "Products", false);