• Home
  • Search
  • Exploring the Effectiveness of LLMs in Automated Logging Statement Generation: An Empirical Study
  • Cite Icon25
  • https://doi.org/10.1109/tse.2024.3475375Copy DOI Icon

Exploring the Effectiveness of LLMs in Automated Logging Statement Generation: An Empirical Study

Show More
  • Abstract
  • Literature Map
  • References
  • Citations
  • Similar Papers
Abstract

Automated logging statement generation supports developers in documenting critical software runtime behavior. While substantial recent research has focused on retrieval-based and learning-based methods, results suggest they fail to provide appropriate logging statements in real-world complex software. Given the great success in natural language generation and programming language comprehension, large language models (LLMs) might help developers generate logging statements, but this has not yet been investigated. To fill the gap, this paper performs the first study on exploring LLMs for logging statement generation. We first build a logging statement generation dataset, <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">LogBench</i>, with two parts: (1) <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">LogBench-O</i>: <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">3,870</i> methods with <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">6,849</i> logging statements collected from GitHub repositories, and (2) <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">LogBench-T</i>: the transformed unseen code from LogBench-O. Then, we leverage LogBench to evaluate the <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">effectiveness</i> and <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">generalization capabilities</i> (using <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">LogBench-T</i>) of 13 top-performing LLMs, from 60M to 405B parameters. In addition, we examine the performance of these LLMs against classical retrieval-based and machine learning-based logging methods from the era preceding LLMs. Specifically, we evaluate the logging effectiveness of LLMs by studying their ability to determine logging ingredients and the impact of prompts and external program information. We further evaluate LLM's logging generalization capabilities using unseen data (LogBench-T) derived from code transformation techniques. While existing LLMs deliver decent predictions on logging levels and logging variables, our study indicates that they only achieve a maximum BLEU score of <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">0.249</i>, thus calling for improvements. The paper also highlights the importance of prompt constructions and external factors (e.g., programming contexts and code comments) for LLMs’ logging performance. In addition, we observed that existing LLMs show a significant performance drop (<italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">8.2%-16.2%</i> decrease) when dealing with logging unseen code, revealing their unsatisfactory generalization capabilities. Based on these findings, we identify five implications and provide practical advice for future logging research. Our empirical analysis discloses the limitations of current logging approaches while showcasing the potential of LLM-based logging tools, and provides actionable guidance for building more practical models.

Similar Papers
  • Conference Article

CrossLM: A Data-Free Collaborative Fine-Tuning Framework for Large and Small Language Models

  • Jun 23, 2025
  • Yongheng Deng +5
  • Research Article
  • Citations11

How Can IJDS Authors, Reviewers, and Editors Use (and Misuse) Generative AI?

  • Apr 01, 2023
  • INFORMS Journal on Data Science
  • Galit Shmueli +7
  • Research Article
  • Citations6

Tax Intelligent Decision-Making Language Model

  • Jan 01, 2024
  • IEEE Access
  • Yan Zhong +2
  • Conference Article
  • Citations57

UniLog: Automatic Logging via LLM and In-Context Learning

  • Feb 06, 2024
  • Junjielong Xu +11
  • Research Article
  • Citations1

An Empirical Study on Language Models for Generating Log Statements in Test Code

  • Aug 12, 2025
  • ACM Transactions on Software Engineering and Methodology
  • Honglin Shu +4
  • Research Article
  • Citations8

On Continually Tracing Origins of LLM-Generated Text and Its Application in Detecting Cheating in Student Coursework

  • Feb 20, 2025
  • Big Data and Cognitive Computing
  • Quan Wang +1
  • Research Article
  • Citations19

RetClean: Retrieval-Based Data Cleaning Using LLMs and Data Lakes

  • Aug 01, 2024
  • Proceedings of the VLDB Endowment
  • Zan Ahmad Naeem +4
  • Conference Article
  • Citations4

Do LLMs Overcome Shortcut Learning? An Evaluation of Shortcut Challenges in Large Language Models

  • Jan 01, 2024
  • Yu Yuan +4
  • Research Article

Exploring the potential of large language models in healthcare: a focus on cardiovascular disease analysis.

  • Dec 01, 2026
  • Health information science and systems
  • Aihua Li +4
  • Research Article
  • Citations67

A Deep Dive into Large Language Models for Automated Bug Localization and Repair

  • Jul 12, 2024
  • Proceedings of the ACM on Software Engineering
  • Soneya Binta Hossain +7
  • Research Article

Conversational Information Retrieval by Leveraging Llms to Enhance User Experience

  • Jan 01, 2025
  • International Journal of All Research Education and Scientific Methods
  • Amit Raj +2
  • Research Article
  • Citations6

CoRA: Collaborative Information Perception by Large Language Model’s Weights for Recommendation

  • Apr 11, 2025
  • Proceedings of the AAAI Conference on Artificial Intelligence
  • Yuting Liu +7
  • Research Article
  • Citations894

A survey on large language model (LLM) security and privacy: The Good, The Bad, and The Ugly

  • Mar 01, 2024
  • High-Confidence Computing
  • Yifan Yao +5
  • PDF
  • Research Article
  • Citations3

Exploring the Synergy of Grammar-Aware Prompt Engineering and Formal Methods for Mitigating Hallucinations in LLMs

  • Aug 15, 2024
  • East African Journal of Information Technology
  • Tibakanya Joseph +1
  • Research Article
  • Citations7

Beyond Text Generation: Assessing Large Language Models’ Ability to Reason Logically and Follow Strict Rules

  • Jan 15, 2025
  • AI
  • Zhiyong Han +4
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.