arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2502.03160cs.SE
收藏

AL-Bench:一个用于自动日志记录的基准

AL-Bench: A Benchmark for Automatic Logging

Boyin Tan, Junjielong Xu, Zhouruixing Zhu, Pinjia He

AI总结:

针对自动日志记录评估公平性与静态评估的局限,提出综合基准 AL-Bench,包含大规模数据集与动态评估方法,揭示现有工具在编译率和日志语义相似度上的显著缺陷。

摘要:

日志记录,即在源代码中插入日志语句的实践,对于提高软件可靠性至关重要。最近,已经开发了基于语言模型的技术,以根据输入代码自动生成日志语句。虽然这些工具在先前的研究中显示出有希望的结果,但由于使用了临时数据集,其结果比较的公平性无法得到保证。此外,完全依赖于代码相似性度量的现有评估方法无法捕捉代码差异对运行时日志记录行为的影响,因为微小的代码修改可能导致程序无法编译以及日志输出语义的巨大差异。为了增强日志记录评估的一致性和可重复性,我们引入了 AL-Bench,这是一个专门为自动日志记录工具设计的综合基准。AL-Bench 包含一个大规模、高质量、多样化的数据集,该数据集收集自 10 个具有不同日志记录需求的广泛认可的项目。此外,它引入了一种新颖的动态评估方法,以在源代码级别的传统静态评估之外,提供日志记录质量的运行时视角。具体而言,AL-Bench 不仅评估源代码中标准答案与预测日志语句之间的相似性,还评估在运行时由这两种日志语句打印的日志文件之间的差异。AL-Bench 揭示了现有静态评估的显著局限性,因为与之前报告的结果相比,所有日志记录工具在预测日志位置、级别和消息方面的平均准确率分别下降了 37.49%、23.43% 和 15.80%。此外,通过动态评估,AL-Bench 发现这些生成的日志语句中有 20.1%-83.6% 无法编译。此外,表现最好的工具在标准答案与生成日志语句的日志文件之间仅达到 21.32% 的余弦相似度。

英文摘要:

Logging, the practice of inserting log statements into source code, is critical for improving software reliability. Recently, language model-based techniques have been developed to automate log statement generation based on input code. While these tools show promising results in prior studies, the fairness of their results comparisons is not guaranteed due to the use of ad hoc datasets. In addition, existing evaluation approaches exclusively dependent on code similarity metrics fail to capture the impact of code diff on runtime logging behavior, as minor code modifications can induce program uncompilable and substantial discrepancies in log output semantics. To enhance the consistency and reproducibility of logging evaluation, we introduce AL-Bench, a comprehensive benchmark designed specifically for automatic logging tools. AL-Bench includes a large-scale, high-quality, diverse dataset collected from 10 widely recognized projects with varying logging requirements. Moreover, it introduces a novel dynamic evaluation methodology to provide a run-time perspective of logging quality in addition to the traditional static evaluation at source code level. Specifically, AL-Bench not only evaluates the similarity between the oracle and predicted log statements in source code, but also evaluates the difference between the log files printed by both log statements during runtime. AL-Bench reveals significant limitations in existing static evaluation, as all logging tools show average accuracy drops of 37.49%, 23.43%, and 15.80% in predicting log position, level, and message compared to their reported results. Furthermore, with dynamic evaluation, AL-Bench reveals that 20.1%-83.6% of these generated log statements are unable to compile. Moreover, the best-performing tool achieves only 21.32% cosine similarity between the log files of the oracle and generated log statements.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑