使用编码代理自动剪枝日志代码:我们进展如何?
Towards Automatically Pruning Logging Code with Coding Agents: How Far Are We?
浏览论文内容
中文总结 AI 辅助
本研究首次系统探索使用编码代理自动移除日志代码,构建LogRem数据集并评估四种代理,发现当前自动化在准确界定移除范围方面仍有较大提升空间。
中文摘要 AI 辅助
日志代码支持调试、监控和软件维护,但过多的日志记录会增加噪声、带来运行时开销,并掩盖诊断信息。尽管先前的研究已广泛探讨了日志代码的生成与修改,但日志移除方面的研究相对不足。本文中,我们研究了开发者的日志移除实践,并探索使用编码代理来完成此任务。我们从Python和Java仓库中提取并手动验证了日志移除案例,归纳出10种移除模式和11种移除原因,以描述真实软件变更中日志代码被移除的方式及原因。我们进一步构建了LogRem数据集,包含387个真实案例,涵盖直接日志语句移除、日志基础设施移除和日志替换。我们评估了四种编码代理在多种模型设置下的表现,并将其输出与已接受的真实世界变更进行比较。尽管95.6%至100.0%的输出通过了有效性检查,但仅有11.1%至19.6%的输出移除了与对应真实变更相同的日志代码,同时保留了无关代码。代理之间的差异体现在遗漏移除、额外移除和无关代码编辑上,且在日志移除类别和轨迹上存在显著差异。执行成本差异很大,但较高的成本并不总是带来更接近的对齐。提交消息和开发者讨论提供了最大的对齐增益,而分类学指导则持续减少运行时间。总体而言,我们的研究将日志移除确立为一项独立的软件维护任务,并表明可靠的自动化依赖于准确确定移除范围同时保留必要代码。据我们所知,这是首次从这一视角审视日志代码移除的研究。
英文摘要
Logging code supports debugging, monitoring, and software maintenance, but excessive logging can add noise, impose runtime overhead, and obscure diagnostic information. While prior research has extensively studied logging code generation and modification, logging removal remains comparatively underexplored. In this paper, we study developer logging removal practices and explore the use of coding agents for this task. We extract and manually validate logging removal cases from Python and Java repositories and derive 10 removal patterns and 11 removal reasons that characterize how and why logging code was removed in real-world software changes. We further construct LogRem, a dataset of 387 real-world cases covering direct logging statement removal, logging infrastructure removal, and logging replacement. We evaluate four coding agents with multiple model settings and compare their outputs with accepted real-world changes. Although 95.6% to 100.0% of outputs pass validity checks, only 11.1% to 19.6% remove the same logging code as the corresponding real-world change while preserving unrelated code. Agents differ through missed removals, extra removals, and unrelated code edits, with substantial variation across logging removal categories and trajectories. Execution cost varies widely, but higher cost does not consistently yield closer alignment. Commit messages and developer discussions provide the largest alignment gains, while taxonomy guidance consistently reduces runtime. Overall, our study establishes logging removal as a distinct software maintenance task and shows that reliable automation depends on accurately determining removal scope while preserving necessary code. To the best of our knowledge, this is the first study to examine logging code removal from this perspective.
发表机构
- York University(约克大学)
- University of Waterloo(滑铁卢大学)
- HKUST (Guangzhou)(香港科技大学(广州))
- University of Alberta(阿尔伯塔大学)
- DGIST(大邱庆北科学技术院)
机构由 AI 辅助整理,请以论文原文为准。