← Lab /Software

LLMs detect logging security issues with up to 52.5% accuracy but struggle to repair code

LLMs can moderately detect logging security issues but cannot reliably generate correct repairs

Software arXiv 22 Apr 2026 Measurement Simulation evidence

Published as “Towards Secure Logging: Characterizing and Benchmarking Logging Code Security Issues with LLMs”

Why it matters

LLMs can aid developers in spotting obvious logging security flaws, but their inconsistent detection and repair performance mean human review and careful prompt design remain essential.

Summary

LLMs can detect some logging security issues but overall detection accuracy is low, ranging from 12.9% to 52.5% across models, with DeepSeek-V3 achieving the highest category accuracy of 85.7% on Sensitive Information Exposure. Repair quality is modest, with the best Patch Similarity of 69.3% (DeepSeek-V3, Base prompt) and average similarity around 44%, and adding extra context often hurts performance. The study provides a taxonomy and a 101-issue benchmark (SecLogging) to evaluate these capabilities.

What they found 3

  1. LLM detection accuracy varies widely, from 12.9% to 52.5% at the category level.

    “Our evaluation results show that the ability of LLMs to detect logging code security issues varies considerably, with category-level accuracy ranging from 12.9% to 52.5%.”

  2. DeepSeek-V3 attains the highest detection accuracy on the EE category, reaching 85.7% under certain settings.

    “DeepSeek-V3 reaching as high as 85.7% accuracy under certain settings.”

  3. Repair patch similarity peaks at 69.3% for DeepSeek-V3 in the Base prompt setting.

    “DeepSeek-V3 peaks at 69.3% in the Base setting”

Caveats 2

  • Adding contextual information does not consistently improve repair patch generation; the lowest average similarity (36.5%) occurs with the +E+D prompt configuration.
  • Combining description and explanation (+D+E) can degrade detection performance, e.g., Llama3.3’s accuracy drops to 34.7% under (+D+E).

What’s new here 4

  • Derives a taxonomy of logging code security issues (4 categories, 10 patterns) from literature and vulnerability databases.
  • Constructs the SecLogging benchmark containing 101 real-world logging security issues.
  • Evaluates both detection and automated repair of these issues across a range of open-source and proprietary LLMs.
  • Analyzes the impact of different prompt configurations on LLM performance for this domain.