SDK log buffering

How Bugfender works offline and how logs are stored in the mobile device: size limit, security and eviction of the logs stored

Jordi Giménez avatar
Written by Jordi Giménez
Updated over a week ago

Bugfender SDK stores logs temporarily in the mobile device's internal memory until they are sent to the server. This buffering helps dealing with log spikes that could otherwise overwhelm the memory, and sending the logs later in case the mobile device does not have network connectivity.

Why is there a storage limit?

In case the mobile device never connects to the Internet, or if it's not enabled to send logs to Bugfender server at the moment, we need to have a maximum storage size in order to prevent that your application takes all the disk space available in the mobile device, which certainly would annoy your users.

Do disabled mobile devices store logs on disk?

Yes, they do. When you enable a device for the first time after being disabled, all logs stored in the disk are flushed.

Do devices store logs on disk while connected to the internet?

Yes, logs are always buffered on disk and sent in batches, even if an internet connection is present. In normal network conditions, logs are sent every 30 seconds and should appear on your dashboard in under 2 minutes.

In which part of the internal memory are logs stored?

Access is restricted exclusively to the application by operating system file permissions.

On iOS, logs are stored in the cache directory. This gives the operating system a chance to delete them if low on disk space.

Is there a way to tell when the limit has been hit?

Yes, a special log called "bf_gap_log" is written to signal some logs are missing.

Changing the limit

There is a configuration method to change the maximum allowed capacity of this cache, since a mobile device that is kept offline for a long time could potentially accumulate too much data and fill up the internal memory of the device. The default value 5 MB, but you can change it with setMaximumLocalStorageSize.

For example in Android:

Bugfender.setMaximumLocalStorageSize(10*1024*1024); // 10 MB

Or in iOS (Objective-C):

[Bugfender setMaximumLocalStorageSize:10*1024*1024]; // 10 MB

Or in iOS (Swift):

Bugfender.setMaximumLocalStorageSize(10*1024*1024) // 10 MB

Logs are stored in the internal memory of the application, inaccessible by other applications.

Do logs stored locally on the device count toward the daily limit of my plan?

No, only logs sent to the Bugfender servers count toward your plan's limit.

See also

Did this answer your question?