Android
Secure logs
Configure the Thales SDK to generate secure, obfuscated log files.
Enable or disable secure logging
Secure logging is enabled by default. You can disable it during Thales SDK initialization:
Context context;
String serverUrl;
byte[] serverCertificate;
String keyIdentifier;
TMGClientConfiguration configuration = new TMGClientConfiguration(activity,
serverUrl,
serverCertificate,
keyIdentifier);
configuration.enableSecureLog(false);In this example, enableSecureLog(false) disables log generation after TMGClientConfiguration is instantiated. With the default setting (true), the SDK writes logs for the lifetime of the app process.
You can also pause logging temporarily:
// Disable Secure log temporarily.
TMGClient.getInstance().getSecureLog().setLevel(SecureLogLevel.OFF);
// Resume logging with the default log level.
TMGClient.getInstance().getSecureLog().setLevel(SecureLogLevel.WARN);Setting the log level to OFF prevents the Thales SDK from writing any new log entries. Set the level back to WARN (default) or another level to resume logging.
Retrieve secure log files
The Thales SDK generates log files in the application sandbox. Retrieve them like this:
secureLogFiles contains a list of File objects for the available log files. Share these files with the Thales delivery team when investigating an issue.
Logcat logs
Method 1: capture logs with adb
Before you capture logs from an Android device, confirm the following:
The Android Debug Bridge tool (ADB) is ready at the host system.
The USB debugging option is enabled on the device under test.
If not enabled, go to Settings > Developer options > USB debugging.
The Android device is connected to the host system using a USB cable, and the USB driver is installed.
You may execute the following command in the command prompt to verify your setup:
A response similar to the following code snippet indicates that the device can be reached by the ADB tool:
Recommended steps for capturing logs
Open the command prompt and clear all the log buffers in the device:
Start the log capturing:
Replace LogFileName.txt with your preferred filename.
Perform the use case(s).
Press CTRL+C in the command prompt to stop the log capturing.
Retrieve
LogFileName.txtfrom the directory where you ran step 2.
Method 2: use Android Studio Logcat
View logs directly in the Android Studio Logcat tool window.
Bring up the Logcat tab which can be found on the side or bottom tool bar.
Ensure a device is connected, and run the required use cases for the program.
Filter the messages with
TMGSDKtag.The logs will appear in the Logcat tab.
Last updated
Was this helpful?