Towards Automatically Pruning Logging Code with Coding Agents: How Far Are We?

📅 2026-10-03
📈 Citations: 0
✨ Influential: 0
📄 PDF
🤖 AI Summary
This study addresses the underexplored problem of redundant logging code and its automated removal by establishing log cleanup as a distinct maintenance task from a removal perspective. We construct the LogRem dataset by extracting real-world instances through static analysis, systematically characterizing log removal patterns and motivations. Furthermore, we conduct automated experiments and multidimensional evaluations leveraging large language model-based coding agents. Results indicate that while agent-generated outputs are functionally effective, only approximately 15% precisely match human modifications; however, incorporating supplementary contextual information significantly improves alignment. This work fills a critical gap in the log removal domain and delineates the capability boundaries and cost-effectiveness of current coding agents in automating log cleanup tasks.
📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

logging code removal
automated pruning
coding agents
software maintenance
Innovation

Methods, ideas, or system contributions that make the work stand out.

Logging Code Removal
Coding Agents
LogRem Dataset
Software Maintenance
Automated Pruning
🔎 Similar Papers
No similar papers found.