See How Logging Can Be Used in Your Android Application
- How to use the Logging component to log messages
- How to change the log level
- How to upload and view logs in the SAP Mobile Services cockpit
- Step 1
- Step 2
Navigate to the entity list screen and open the app’s menu.
Select Log Level.
Set the level to Debug.
Navigate back to the entity list screen, then back into the Settings screen to see the effect of changing the log level.
Examine the Logcat (located at the bottom of the Android Studio screen, click it and you can see the logs). In the filter, add the name of the class that we are interested in seeing the log from:
Notice that the messages were logged since the log level of the app was set to Debug or Path.
The SDK libraries also log output based on the app’s log level.
Change the filter to
Press Back to exit the app and you will see the logged lines from the foundation library.
- Step 3
Navigate back to the Settings menu in the app, and this time tap Upload Log.
A Toast message is displayed confirming that the upload succeeded.
In the Mobile Services cockpit, navigate to Mobile Applications > Native/Hybrid > com.sap.wizapp > Mobile Client Log Upload.
Select the Logs tab and you will see the log you just uploaded in the list. You can download the text messages of the logs by clicking the Download sign. If the log doesn’t appear immediately, wait for a few moments, then click Go to refresh the view.
You can inspect the log details in the browser by clicking on its table entry. The following screenshot contains the details of the first log.
Additionally, you can access the logs locally on an emulator. You can browse the file system of an Android emulator using the Device File Explorer to view the log files as shown below, in data > data > com.sap.wizapp (or the package name of your project) > files.
You can manage the initial log level of the application and the ability for mobile services to accept logs on the Configuration page, as shown below.
For further information on logging, see Logging.
Congratulations! You have explored how you can use the logging feature to debug or support a deployed application.