mlsanityData to 7 Oct 2026

Go Static: Contextualized Logging Statement Generation

arXiv 2402.12958 ↗First posted 20 Feb 2024cs.SEcited by 8

Not on the map. Why?

Abstract (arXiv)

Logging practices have been extensively investigated to assist developers in writing appropriate logging statements for documenting software behaviors. Although numerous automatic logging approaches have been proposed, their performance remains unsatisfactory due to the constraint of the single-method input, without informative programming context outside the method. Specifically, we identify three inherent limitations with single-method context: limited static scope of logging statements, inconsistent logging styles, and missing type information of logging variables. To tackle these limitations, we propose SCLogger, the first contextualized logging statement generation approach with inter-method static contexts. First, SCLogger extracts inter-method contexts with static analysis to construct the contextualized prompt for language models to generate a tentative logging statement. The contextualized prompt consists of an extended static scope and sampled similar methods, ordered by the chain-of-thought (COT) strategy. Second, SCLogger refines the access of logging variables by formulating a new refinement prompt for language models, which incorporates detailed type information of variables in the tentative logging statement. The evaluation results show that SCLogger surpasses the state-of-the-art approach by 8.7% in logging position accuracy, 32.1% in level accuracy, 19.6% in variable precision, and 138.4% in text BLEU-4 score. Furthermore, SCLogger consistently boosts the performance of logging statement generation across a range of large language models, thereby showcasing the generalizability of this approach.

Key facts. Cited by 8 papers in the map (data through 7 Oct 2026). First posted on arXiv 20 Feb 2024.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 3; 2025: 4; 2026: 1.

8 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026ThinkLog: Leveraging Reasoning for Log Statement Generation
  2. 2025Larger Is Not Always Better: Exploring Small Open-source Language Models in Logging Statement Generation
  3. 2026Towards Automatically Pruning Logging Code with Coding Agents: How Far Are We?
  4. 2025Defects4Log: Benchmarking LLMs for Logging Code Defect Detection and Reasoning
  5. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?
  6. 2024RAMBO: Enhancing RAG-based Repository-Level Method Body Completion
  7. 2025MRG-Bench: Evaluating and Exploring the Requirements of Context for Repository-Level Code Generation
  8. 2026In Line with Context: Repository-Level Code Generation via Context Inlining