Digipass S3 is now DigipassONE. This section is currently being updated to reflect our new name.

Client logging options

Prev Next

Mobile applications in the field occasionally experience problems that require a developer's attention to fix. It is often difficult to reproduce problems in the field. Developers who worked on the code for the problem application often do not have the environment or exact device with which to test. In these situations, it is helpful to be able to retrieve debug logs from the client devices as the problems occur in the field.

This article outlines a possible process to generate, transmit, and retrieve mobile application logs.

Enabling App SDK logging

The App SDK logging allows an app to easily intercept all log messages generated by the App SDK. There is sample code in the Tutorial App to show how this is done. Refer to SampleLogger.swift for details. Consider the following points:

  1. Calling ILogger::setInstance routes all log messages to the print method in your ILogger implementation.

  2. The logs do not necessarily indicate an issue. Instead, the logLevel value indicates the severity of the issue.

  3. Your ILogger implementation has the option of calling the existing logger if you still want to log to the console. This is what SampleLogger does.

  4. If logging is explicitly disabled by calling ClientConfig::setLoggingDisabled(true), then print will not be called. By default, logging is enabled.

Appending client logs to alternating files

To save logs leading up to a crash, append logs to a file. Once the file reaches a predetermined size, close it, and then begin writing to a second file. Once that file reaches a predetermined size, close it and then overwrite the first file. Each file should be large enough to hold at least one minute worth of logging data or one thousand log lines.

Transmitting client logs to a central server

Once the application restarts, the file(s) should be uploaded to a server where it can be examined. Limits should be set to only transmit logs a certain number of times per day to the server. For example, if an application repeatedly crashes ten times a day, do not upload the logs ten times a day.

If desired, additional information could be uploaded to identify the client device.