发表机构
University of California, Irvine; Amazon; ETH Zürich(加州大学尔湾分校; 亚马逊; 苏黎世联邦理工学院)
机构由 AI 辅助整理,请以论文原文为准。AI 中文总结
本研究通过挖掘含临时日志的意外提交和分析实时编程会话,构建了多语言大型数据集,揭示了开发者使用临时日志的模式,为调试和日志工具开发提供了实证依据与数据集。
AI 中文摘要
开发者常会插入临时打印或日志语句,即所谓的**临时日志(ad-hoc logs)**,以更好地理解程序的运行时行为,尤其是在遇到意外问题或复杂控制流时。尽管这是几乎普遍存在的实践,但由于这类日志具有临时性:它们通常仅保留在本地环境中,且会在代码提交前被删除,因此难以捕获,相关系统研究十分有限。在本研究中,我们通过挖掘开发者意外留下临时日志后又删除它们的意外提交,以及分析实时编程会话以观察临时日志的实际使用情况,解决了这一挑战。利用这些方法,我们构建了涵盖三种主要编程语言(Java、JavaScript 和 Python)的大型数据集,从而能够对日志实践进行大规模研究。我们的分析揭示了开发者依赖临时日志的位置和方式的共性及特定语言模式。在所有语言中,临时日志往往出现在运行时更难推理的程序区域。我们还识别出独特的语言级模式,例如 JavaScript 中频繁用于异步和回调函数,Java 中频繁用于线程相关类。此外,包含临时日志的函数的圈复杂度通常高于整体函数群体。生产日志也显示出类似的关联,这与日志作为观察结构复杂函数运行时行为的手段一致。这些发现共同为开发者的运行时理解实践提供了实证见解,并为寻求更好支持调试和日志记录的研究人员及工具构建者提供了宝贵的数据集。
英文摘要
Developers frequently insert temporary print or log statements, known as **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.
CommentsAccepted to EMSE