mlsanityData to 14 Oct 2026

Defects4Log: Benchmarking LLMs for Logging Code Defect Detection and Reasoning

arXiv 2508.11305 ↗First posted 15 Aug 2025cs.SEcited by 2

Not on the map. Why?

Abstract (arXiv)

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 unexplored. In 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, dataset, 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.

Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). First posted on arXiv 15 Aug 2025.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 2.

2 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2024Understanding Defects in Generated Codes by Language Models
  2. 2026LogDx-CI: Benchmarking Log Reduction Tools for LLM Root-Cause Diagnosis
  3. 2025Demystifying Errors in LLM Reasoning Traces: An Empirical Study of Code Execution Simulation
  4. 2025LogReasoner: Empowering LLMs with Expert-like Coarse-to-Fine Reasoning for Automated Log Analysis
  5. 2026ThinkLog: Leveraging Reasoning for Log Statement Generation
  6. 2025CoRe: Benchmarking LLMs Code Reasoning Capabilities through Static Analysis Tasks
  7. 2026Benchmarking Small Language Models and Small Reasoning Language Models on System Log Severity Classification
  8. 2025Larger Is Not Always Better: Exploring Small Open-source Language Models in Logging Statement Generation