Skip to main content

Android Logging

Memfault Caliper collects logs from every logcat buffer. Logs are uploaded when they overlap a trace event, and are associated with the trace.

Log files collected by Caliper are scrubbed on-device before being uploaded. See Data Scrubbing

info

Logs can also be collected via bug reports - but this is not recommended.

Configuration

Bort will process the stored logcat logs for issues, which can be configured from the Project Settings page under Data Sources.

Kernel Oopses

Android Kernel Oops are Linux OS errors. They are sometimes non-fatal, but can also precede a fatal Kernel Panic.

SELinux Violations

Android SELinux Violations are records of denials to access resources from any running application.

Caliper Logging Modes

Periodic

The default behavior. Bort will collect logcat from all buffers at a regular interval (15 minutes).

In the case of log buffer expiry (if log buffers are too small, or if the device has particularly spammy logging), it is possible that some logs may be missed.

Continuous

This mode is designed to avoid missing logs due to buffer expiry.

The MemfaultDumpster system service continuously reads from all log buffers. --wrap mode is used, so that logs are only written to disk on buffer expiry or timeout (i.e. the service is not continuously writing logs to disk).

The Flush To Storage setting controls the maximum period before logs are flushed to disk if no buffers have expired. This does not affect how log files are chunked for upload.

Log upload works the same way as for Periodic.

Automatic Log Collection

Memfault collects logs either periodically or continuously, but not all logs that are collected by the SDK will be uploaded.

Out of the box, Memfault will only mark logs for upload if that log covers "events of interest", such as crashes. This ensures that we can surface the relevant context at the right time, to aid debugging that issue.

Logs are uploaded only when events of interest are detected

Logs are uploaded only when events of interest are detected.

With Fleet Sampling, it is also possible to upload logs that were collected in the near past:

  • If we turn on the debugging fleet sampling aspect for a device after an event of interest, the device will upload existing logs marked for upload collected before that the aspect was enabled.
  • If we turn on the logging fleet sampling aspect, then all logs, both in the near past and moving forward, will be uploaded.

When logs are captured, the timezone of the logs are set to UTC rather than device timezone. You will notice this when downloading the raw logs from a device's logfiles tab. If you view the logs via the Memfault Log Viewer, they will be displayed in the timezone currently selected in the Timezone Selector (default: browser timezone).