mlsanityData to 7 Oct 2026

ThinkLog: Leveraging Reasoning for Log Statement Generation

arXiv 2607.11615 ↗First posted 13 Jul 2026cs.SEcited by 0

On the map: LLM reasoning → Reasoning for agents, planning and code

Abstract (arXiv)

Runtime logs are an important source of information that supports software maintenance. To obtain useful logs, developers spend significant effort identifying appropriate log locations, assigning correct severity levels, and writing concise yet informative messages. Therefore, end-to-end automated log statement generation can help reduce this burden, and prior work has proposed many methods for this task. However, existing methods still exhibit limited accuracy. To address this problem, we propose ThinkLog, an LLM-based end-to-end log statement generation method. The core idea of ThinkLog is to incorporate reasoning that helps LLMs make decisions about log insertion, severity level assignment, and message generation, thereby improving log statement generation accuracy. ThinkLog injects reasoning into prompts as few-shot examples and guides LLMs to generate appropriate log statements. Evaluated on 9,619 Java methods extracted from public GitHub repositories, ThinkLog achieves 20.55% log statement generation accuracy, representing a 15.4% improvement over the best existing method. Moreover, these improvements were achieved at approximately 50% of the inference cost (USD) compared to the best existing method. These results show that leveraging reasoning is an effective and cost-efficient way to improve the accuracy of end-to-end log statement generation.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 3 of its 31 references that are in the map. First posted on arXiv 13 Jul 2026.

Builds on

3 of 31 references.

References · 3

  1. 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
  2. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  3. 2025Is Chain-of-Thought Reasoning of LLMs a Mirage? A Data Distribution Lenscited by 42

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025LogReasoner: Empowering LLMs with Expert-like Coarse-to-Fine Reasoning for Automated Log Analysis
  2. 2025Larger Is Not Always Better: Exploring Small Open-source Language Models in Logging Statement Generation
  3. 2024Go Static: Contextualized Logging Statement Generation
  4. 2025Demystifying Errors in LLM Reasoning Traces: An Empirical Study of Code Execution Simulation
  5. 2025Defects4Log: Benchmarking LLMs for Logging Code Defect Detection and Reasoning
  6. 2026LLMs taking shortcuts in test generation: A study with SAP HANA and LevelDB
  7. 2026LogitsCoder: Towards Efficient Chain-of-Thought Path Search via Logits Preference Decoding for Code Generation
  8. 2026DatalogBench: Evaluating Large Language Models on Text-to-Datalog Synthesis