# AI编程代理会像人类一样记录日志吗？一项实证研究

- 来源：HuggingFace Daily Papers（社区热门论文）
- 发布时间：2026-04-10 08:00
- AIHOT 链接：https://aihot.virxact.com/items/cmo0xuwt4035gsli25b69qhlx
- 原文链接：https://arxiv.org/abs/2604.09409

## AI 摘要

本研究对81个开源仓库的4,550个代理拉取请求进行实证分析，发现AI编程代理在58.4%的仓库中比人类更少修改日志，但修改时日志密度更高。研究表明，明确的日志指令极为罕见（4.7%）且效果有限，代理对建设性请求的违规率达67%。此外，人类开发者承担了72.5%的生成后日志修复工作。这些发现揭示了自然语言指令在规范日志实践上的双重失效，建议采用确定性护栏以确保日志质量。

## 正文

Software logging is essential for maintaining and debugging complex systems, yet it remains unclear how AI coding agents handle this non-functional requirement. While prior work characterizes human logging practices, the behaviors of AI coding agents and the efficacy of natural language instructions in governing them are unexplored. To address this gap, we conduct an empirical study of 4,550 agentic pull requests across 81 open-source repositories. We compare agent logging patterns against human baselines and analyze the impact of explicit logging instructions. We find that agents change logging less often than humans in 58.4% of repositories, though they exhibit higher log density when they do. Furthermore, explicit logging instructions are rare (4.7%) and ineffective, as agents fail to comply with constructive requests 67% of the time. Finally, we observe that humans perform 72.5% of post-generation log repairs, acting as "silent janitors" who fix logging and observability issues without explicit review feedback. These findings indicate a dual failure in natural language instruction (i.e., scarcity of logging instructions and low agent compliance), suggesting that deterministic guardrails might be necessary to ensure consistent logging practices.
