Lune

ASE2025顶会

Defects4Log: Benchmarking LLMs for Logging Code Defect Detection and Reasoning

Xin Wang, Zhenhao Li, Zishuo Ding

摘要

Logging code is written by developers to capture system runtime behavior and plays a vital role in debugging, performance analysis, and system monitoring. However, defects in logging code can undermine the usefulness of logs and lead to misinterpretations. Although prior work has identified several logging defect patterns and provided valuable insights into logging practices, these studies often focus on a narrow range of defect patterns derived from limited sources (e.g., commit histories) and lack a systematic and comprehensive analysis. Moreover, large language models (LLMs) have demonstrated promising generalization and reasoning capabilities across a variety of code-related tasks, yet their potential for detecting logging code defects remains largely unexploredIn this paper, we derive a comprehensive taxonomy of logging code defects, which encompasses seven logging code defect patterns with 14 detailed scenarios. We further construct a benchmark dataset, Defects4Log, consisting of 164 developer-verified real-world logging defects. Then we propose an automated framework that leverages various prompting strategies and contextual information to evaluate LLMs’ capability in detecting and reasoning logging code defects. Experimental results reveal that LLMs generally struggle to accurately detect and reason logging code defects based on the source code only. However, incorporating proper knowledge (e.g., detailed scenarios of defect patterns) can lead to 10.9% improvement in detection accuracy. Overall, our findings provide actionable guidance for practitioners to avoid common defect patterns and establish a foundation for improving LLM-based reasoning in logging code defect detection.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Towards Secure Logging: Characterizing and Benchmarking Logging Code Security Issues with LLMs 引用了 LLM4Perf: Large Language Models Are Effective Samplers for Multi-Objective Performance Modeling
  • Towards Secure Logging: Characterizing and Benchmarking Logging Code Security Issues with LLMs 引用了 Where Shall We Log? Studying and Suggesting Logging Locations in Code Blocks
  • Towards Secure Logging: Characterizing and Benchmarking Logging Code Security Issues with LLMs 引用了 DeepLV: Suggesting Log Levels Using Ordinal Based Neural Networks
  • Large Language Models are Zero-Shot Reasoners 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • DeepLV: Suggesting Log Levels Using Ordinal Based Neural Networks 引用了 Where Shall We Log? Studying and Suggesting Logging Locations in Code Blocks
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper2

  1. LLM4Perf: Large Language Models Are Effective Samplers for Multi-Objective Performance ModelingXin Wang, Zhenhao Li, Zishuo DingICSE 2026
  2. Towards Secure Logging: Characterizing and Benchmarking Logging Code Security Issues with LLMsHe Yang Yuan, Xin Wang, Kundi Yao, An Ran Chen 等FSE 2026

它引用的 Paper15

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
  2. Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo 等NeurIPS 2022 · 8,168 次引用
  3. LLMParser: An Exploratory Study on Using Large Language Models for Log ParsingZeyang Ma, An Ran Chen, Dong Jae Kim, Tse-Hsun Chen 等ICSE 2024 · 72 次引用
  4. DeepLV: Suggesting Log Levels Using Ordinal Based Neural NetworksZhenhao Li, Heng Li, Tse-Hsun Peter Chen, Weiyi ShangICSE 2021 · 44 次引用
  5. Where Shall We Log? Studying and Suggesting Logging Locations in Code BlocksZhenhao Li, Tse-Hsun Chen, Weiyi ShangASE 2020 · 41 次引用

相关 Paper

  1. UniLog: Automatic Logging via LLM and In-Context LearningJunjielong Xu, Ziang Cui, Yuan Zhao, Xu Zhang 等ICSE 2024 · 56 次引用
  2. LILAC: Log Parsing using LLMs with Adaptive Parsing CacheZhihan Jiang, Jinyang Liu, Zhuangbin Chen, Yichen Li 等FSE 2024 · 85 次引用
  3. LLMLog: Advanced Log Template Generation via LLM-driven Multi-Round AnnotationFei Teng, Haoyang Li, Lei ChenVLDB 2025 · 2 次引用
  4. Can LLMs Reason About Program Semantics? A Comprehensive Evaluation of LLMs on Formal Specification InferenceThanh Le-Cong, Bach Le, Toby MurrayACL 2025
  5. Go Static: Contextualized Logging Statement GenerationYichen Li, Yintong Huo, Renyi Zhong, Zhihan Jiang 等FSE 2024 · 17 次引用
黄昏的海面,两侧是细线勾勒的悬崖