arXiv:2610.11041cs.SEOct 2026

Manuscript Offprint

arXiv:2610.11041

Following Breadcrumbs in Code: What Accidentally Committed Ad-Hoc Logs Reveal about Developer Comprehension

Yi-Hung Chou, Boyuan Jiang, Vidit Jain, Yiyang Min, April Yi Wang, James A. Jones

Abstract

Developers frequently insert temporary print or log statements—ad-hoc logs—to better understand program behavior at runtime, particularly when facing unexpected issues or complex control flows. Despite being a nearly universal practice, systematic study has been limited because these logs are ephemeral: they usually remain only in local environments and are removed before code is committed, making them difficult to capture. In this work, we addressed this challenge by mining accidental commits where developers unintentionally left ad-hoc logs and later deleted them, and by analyzing live-streamed programming sessions to observe their use in practice. Using these methods, we constructed a large dataset across three major programming languages (Java, JavaScript, and Python), enabling the large-scale investigation of logging practices. Our analysis reveals both common and language-specific patterns in where and how developers rely on ad-hoc logs. Across languages, ad-hoc logs tend to appear in program regions that are harder to reason about at runtime. We also identify distinctive language-level patterns, such as frequent use in asynchronous and callback functions in JavaScript and in thread-related classes in Java. In addition, functions containing ad-hoc logs generally have higher cyclomatic complexity than the overall function population. Production logs show a similar association, consistent with logging serving as a means of observing runtime behavior in structurally complex functions. Together, these findings provide empirical insight into developers' runtime comprehension practices and offer a valuable dataset for researchers and tool builders seeking to better support debugging and logging.

Keywords Printf Debugging · Program Comprehension

Y. Chou 1^{1} · B. Jiang 1^{1} · V. Jain 1^{1} · Y. Min 2^{2} · A. Wang 3^{3} · J. A. Jones 1^{1}

1^{1}University of California, Irvine, USA

2^{2}Amazon, Toronto, Canada

3^{3}ETH Zürich, Switzerland

E-mail: {yihungc1, boyuanj, viditj3, jajones}@uci.edu, rogermyy@amazon.com, april.wang@inf.ethz.ch

Yi-Hung Chou et al.

1 Introduction

Logging statements in software development generally serve two distinct purposes. (1) The first concerns statements that remain in the codebase after deployment, commonly referred to as production logging statements. These persistent statements are used to monitor run-time behavior and provide diagnostic information, thereby supporting developers in maintaining and troubleshooting software in production. (2) The second, and arguably less recognized yet commonly seen, use of printf statements involves their temporary insertion during development. In this context, developers rely on them as lightweight tools for debugging, testing, or understanding program behavior. Such statements, or ad-hoc logs, are typically removed prior to deployment, and this practice is often referred to as printf debugging.

Logging statements, particularly those that are meant to survive into production, have been extensively studied in the software engineering community, as shown in the survey conducted by Gholamian and Ward (2022) and Chen and Jiang (2022). For example, Fu et al. (2014) investigated where developers place their production logs for monitoring purposes, while Li et al. (2023) conducted manual inspections and surveys to evaluate the readability of logging statements. Building on such motivations, researchers have also proposed methods and tools to automate the improvement of production logging practices. For instance, Zhu et al. (2015) developed tools to support developers in making informed decisions when inserting production logs.

However, to the best of our knowledge, the second type of logs—ad-hoc logs—remains largely understudied in the software engineering literature. Prior observational studies report that developers use ad-hoc logs as one of the most common strategies for program comprehension and debugging (Alaboudi and LaToza, 2019, 2023; Jiang et al., 2023; Beller et al., 2018; Siegmund et al., 2014). Despite their recognized importance, the transient and local nature of these ad-hoc logs has constrained the community's ability to systematically study and understand them.

Although the collection of transient and localized ad-hoc log statements may initially appear infeasible, we argue that two inherent properties of such logs enable their systematic and large-scale identification. First, ad-hoc logs are, by design, not intended to remain in production software. Nevertheless, developers are not immune to errors, and prior empirical studies have shown that inadvertent commits of unintended code artifacts are common in practice Wen et al. (2020); Meli et al. (2019). As a result, when ad-hoc logs are mistakenly introduced into a repository, developers typically issue subsequent corrective commits to remove these statements, thereby leaving recoverable traces. Second, qualitative evidence reported in Chou et al. (2025) indicates that ad-hoc logs are most often implemented through lightweight, native output functions (e.g., System.out.println) rather than standardized and comparatively heavyweight logging frameworks such as log4j. This implementation choice not only distinguishes ad-hoc logs from production-level logging but also makes their detection more tractable. By capitalizing on these proper-

Python: lenstronomy/lenstronomy Message: removing debugging print statements

if check_convention and not self.ignore_observed_positions: kwargs_lens = self._convention(kwargs_lens)

  • print('I am leaving ray shooting partial')

Java: liquibase/liquibase Message: DAT-3587 Remove println

protected void doMigration() throws Exception { if (COMMANDS.HELP.equalsIgnoreCase(command)) { System.out.println("HERE!!!!!!!"); printHelp(System.err); } }

JavaScript: ellismarkf/lark Message: remove console logs

option.destinationArrivalHour = destinationHour; option.destinationArrivalMins = destinationMins;

  • console.log('is this code running?');

Fig. 1 Examples of accidentally committed ad-hoc logs collected in our dataset.

ties, our research leverages the occurrence of ad-hoc logs within corrective commits as a serendipitous opportunity to address a critical research gap: the large-scale collection and analysis of ad-hoc log statements as a means to infer developers' comprehension processes and debugging challenges during software development.

This study sheds light on the subject by examining accidental commits in version-control systems like GitHub, where developers explicitly remove ad-hoc logs, as noted in commit messages (e.g., “remove console.log” or “delete print”). Figure 1 provides examples of ad-hoc logs and the corresponding commit messages. To gain deeper insight into how these logs are used, we also conducted a qualitative analysis of 36 hours of developers’ live-stream sessions collected by Alaboudi and LaToza (2019). Unlike the GitHub commits, which only capture mistakenly preserved logs, the live-stream data reveals all instances of temporary logging and their practical use. This comparison helps us better understand the situations and comprehension challenges in which developers rely on these logs. In short, the GitHub data offers broad coverage and scalability, while the live-stream data provides depth and nuanced qualitative understanding.

Yi-Hung Chou et al.

Our analysis uncovered several noteworthy patterns across three programming languages—Java, JavaScript, and Python. One recurring practice was that developers frequently structured their console outputs in ways that allowed them to quickly identify and compare program states or execution flows in real time. We also observed that ad-hoc logging was disproportionately concentrated in certain types of code locations. For instance, in JavaScript, developers inserted print statements into asynchronous and callback functions more often than would be expected given the overall distribution of such functions in the dataset, suggesting that these contexts demanded additional logging to clarify their behavior. Similarly, in Java, developers placed print statements into thread-related classes more than the overall distribution of such classes in the sample dataset. Furthermore, across three programming languages, ad-hoc logs were used more frequently in functions with high Cyclomatic Complexity than in simpler ones, highlighting their role in aiding comprehension of challenging code segments.

Our study makes the following contributions through extending work in Chou et al. (2025): (1) We extended the empirical study for understanding ad-hoc logs across three languages, guided by research questions informed by prior literature. (2) We analyzed developers' live-coding sessions from Alaboudi and LaToza (2019, 2023) to gain insights into their ad-hoc logging behaviors, which provides qualitative context for understanding the motivations and ad-hoc log-authoring practices. (3) We introduced a novel mining method that captures data previously considered inaccessible or hidden in local environments, such as ad-hoc logs, by leveraging developer mistakes. (4) We collected and published JavaScript, Java, and Python commits from GitHub Archive Grigorik (2015) and Google Cloud BigQuery Google (2025), containing 882,438 removed logs in total, along with corresponding metadata from the GitHub APIs GitHub, Inc. (2025).

References (48)