Logging Practices with Mobile Analytics: An Empirical Study on Firebase

Julian Harty, Haonan Zhang, Lili Wei, Luca Pascarella, Maurício Aniche, Weiyi Shang

Introduction

In modern mobile development, logging has evolved beyond local text files used for debugging. Developers increasingly rely on remote analytics services like Firebase to monitor application behavior in the wild. While traditional logging practices are well-documented, the specific characteristics of mobile analytics logging—how often it occurs, what it tracks, and how it is maintained—remain under-explored. This study provides an empirical characterization of these practices across 57 open-source Android projects.

Methodology

The researchers analyzed a dataset derived from GHTorrent, specifically targeting Android applications that utilize the Firebase Analytics library. A key challenge identified was the "Wrapper Pattern": developers rarely call Firebase APIs directly, instead opting for custom utility classes. By manually identifying these wrappers, the authors were able to accurately quantify logging statements. The study combined quantitative metrics, such as Source Lines of Code (SLOC) per log and code churn, with a qualitative analysis of 300 sampled logging statements.

Characterizing Logging Density

A primary finding of the study is that analytics logging is significantly "sparser" than traditional logging. The median density for analytics logs is 1,148 SLOC per statement, nearly eight times less frequent than the 145 SLOC median observed in traditional local logging.

Distribution of SLOC per logging statement across the studied projects.

As shown in the distribution above, the vast majority of projects maintain a high SLOC-to-log ratio. This selectivity is likely driven by concerns over resource consumption (battery and data) and the need to minimize noise in cloud-based dashboards.

Usage and Maintenance Patterns

The study also revealed that analytics logs are remarkably stable. Only 1.35% of commits involved modifications to analytics code, compared to approximately 10% for traditional logs. This suggests a "set it and forget it" mentality, where analytics are tied to stable business requirements rather than the evolving needs of active debugging.

Distribution of the total number of analytics logging statements per project.

Furthermore, the number of unique logging statements per project is generally low, with most applications implementing fewer than five distinct events. This reinforces the idea that developers are highly intentional about what they choose to track remotely.

Content Analysis and Implications

Qualitative labeling of logging statements showed a clear shift in audience from developers to stakeholders:

  • Domain/Business Events (51.3%): Tracking core value actions like purchases or downloads.
  • UI Events (38.7%): Monitoring user interaction patterns such as button clicks.
  • Failures (6.3%): Surprisingly, analytics are rarely used for error reporting, which is likely offloaded to dedicated crash-reporting tools.

Conclusion

Mobile analytics logging represents a distinct engineering practice focused on user behavior and business logic rather than execution flow. For tool builders, the prevalence of the wrapper pattern suggests that current APIs may be too verbose. For researchers, the stability and sparsity of these logs highlight a different lifecycle compared to traditional diagnostic logging.

Summary updated

Abstract

Software logs are of great value in both industrial and open-source projects. Mobile analytics logging enables developers to collect logs remotely from their apps running on end user devices at the cost of recording and transmitting logs across the Internet to a centralised infrastructure. This paper makes a first step in characterising logging practices with a widely adopted mobile analytics logging library, namely Firebase Analytics. We provide an empirical evaluation of the use of Firebase Analytics in 57 open-source Android applications by studying the evolution of code-bases to understand: a) the needs-in-common that push practitioners to adopt logging practices on mobile devices, and b) the differences in the ways developers use local and remote logging. Our results indicate mobile analytics logs are less pervasive and less maintained than traditional logging code. Based on our analysis, we believe logging using mobile analytics is more user centered compared to traditional logging, where the latter is mainly used to record information for debugging purposes.
BibTeX
@inproceedings{harty2021logging,
  author = {Julian Harty and Haonan Zhang and Lili Wei and Luca Pascarella and Maurício Aniche and Weiyi Shang},
  title = {{Logging Practices with Mobile Analytics: An Empirical Study on Firebase}},
  booktitle = {MOBILESoft@ICSE},
  year = {2021},
  url = {https://openreview.net/forum?id=3jHyWFlqIv},
}
Figure