Collect logs with LogService
Overview
The NFC Wallet SDK collects runtime logs and stores them in the application sandbox.
Your digital wallet application can retrieve log files and share them with Thales for troubleshooting.
Starting with NFC Wallet SDK 6.14.0, logging is enabled automatically with the default configuration.
SDK integration
Get the log service
Retrieve the LogService instance:
LogService logService = SDKInitializer.getLogService(context);val logService = SDKInitializer.getLogService(context)The SDK applies the default configuration automatically during SDK initialization.
// Before 6.14.0
SecureLog secureLog = SDKInitializer.INSTANCE.configureSecureLog(
new SecureLogConfig.Builder(context)
.build()
);
secureLog.setLevel(SecureLogLevel.INFO);
List<File> files = secureLog.getFiles();
secureLog.deleteFiles();
// Since 6.14.0
LogService logService = SDKInitializer.getLogService(context);
logService.setLevel(LogService.Level.INFO);
List<File> files = logService.getFiles();
logService.deleteFiles();// Before 6.14.0
val secureLog = SDKInitializer.INSTANCE.configureSecureLog(
SecureLogConfig.Builder(context).build()
)
secureLog.setLevel(SecureLogLevel.INFO)
val files = secureLog.files
secureLog.deleteFiles()
// Since 6.14.0
val logService = SDKInitializer.getLogService(context)
logService.setLevel(LogService.Level.INFO)
val files = logService.files
logService.deleteFiles()Change log level
Use setLevel(...) to change the log level. The default log level is Level.WARN.
Set the level to OFF to stop writing new log entries.
Log levels
Use the lowest level that supports your use case.
ALL
7
Capture all log entries. Equivalent to DEBUG.
DEBUG
7
Capture detailed logs for troubleshooting. Use temporarily only.
INFO
6
Capture routine operational logs.
ERROR
3
Capture runtime errors that require investigation.
WARN
4
Capture warnings. This is the default level.
FATAL
2
Capture unrecoverable runtime errors only.
OFF
0
Disable logging.
Disable logging
Starting with NFC Wallet SDK 6.14.0, logging is enabled by default.
Set the level to OFF to disable it:
Retrieve log files
After you retrieve the LogService instance, call getFiles():
Call deleteFiles() to delete the log files:
Full example
This example retrieves the log service instance, zips all log files, and shares them using an Android share sheet.
Migrate from secure logger API
Remove the deprecated configuration code.
Then retrieve the LogService instance when you need it.
SDKInitializer.INSTANCE.configureSecureLog(SecureLogConfig)
SDKInitializer.getLogService(Context)
SecureLogConfig.Builder(...)
No replacement. The SDK uses the default configuration.
secureLog.setLevel(SecureLogLevel.X)
logService.setLevel(LogService.Level.X)
secureLog.getFiles()
logService.getFiles()
secureLog.deleteFiles()
logService.deleteFiles()
Last updated
Was this helpful?