On the Temporal Relations between Logging and Code
Zishuo Ding, Yiming Tang, Yang Li, Heng Li, Weiyi Shang
Abstract
Prior work shows that misleading logging texts (i.e., the textual descriptions in logging statements) can be counterproductive for developers during their use of logs. One of the most important types of information provided by logs is the temporal information of the recorded system behavior. For example, a logging text may use a perfective aspect to describe a fact that an important system event has finished. Although prior work has performed extensive studies on automated logging suggestions, few of these studies investigate the temporal relations between logging and code. In this work, we make the first attempt to comprehensively study the temporal relations between logging and its corresponding source code. In particular, we focus on two types of temporal relations: (1) logical temporal relations, which can be inferred from the execution order between the logging statement and the corresponding source code; and (2) semantic temporal relations, which can be inferred based on the semantic meaning of the logging text. We first perform qualitative analyses to study these two types of logging-code temporal relations and the inconsistency between them. As a result, we derive rules to detect these two types of temporal relations and their inconsistencies. Based on these rules, we propose a tool named TempoLo to automatically detect the issues of temporal inconsistencies between logging and code. Through an evaluation of four projects, we find that TempoLo can effectively detect temporal inconsistencies with a small number of false positives. To gather developers' feedback on whether such inconsistencies are worth fixing, we report 15 detected instances from these projects to developers. 13 instances from three projects are confirmed and fixed, while two instances of the remaining project are pending at the time of this writing. Our work lays the foundation for describing temporal relations between logging and code and demonstrates the potential for a deeper understanding of the relationship between logging and code.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 6d5c56b9-3b47-407c-a533-c07fc6d50c5eCited by top-tier papers5
- Go Static: Contextualized Logging Statement GenerationYichen Li, Yintong Huo, Renyi Zhong, Zhihan Jiang et al.FSE 2024 · 17 citations
- Are They All Good? Studying Practitioners' Expectations on the Readability of Log MessagesZhenhao Li, An Ran Chen, Xing Hu, Xin Xia et al.ASE 2023 · 6 citations
- Understanding Practitioners' Expectations on Clear Code Review CommentsJunkai Chen, Zhenhao Li, Qiheng Mao, Xing Hu et al.ISSTA 2025 · 4 citations
- Defects4Log: Benchmarking LLMs for Logging Code Defect Detection and ReasoningXin Wang, Zhenhao Li, Zishuo DingASE 2025 · 1 citation
- Towards Secure Logging: Characterizing and Benchmarking Logging Code Security Issues with LLMsHe Yang Yuan, Xin Wang, Kundi Yao, An Ran Chen et al.FSE 2026
Builds on5
- Using Deep Learning to Generate Complete Log StatementsAntonio Mastropaolo, Luca Pascarella, Gabriele BavotaICSE 2022 · 60 citations
- DeepLV: Suggesting Log Levels Using Ordinal Based Neural NetworksZhenhao Li, Heng Li, Tse-Hsun Peter Chen, Weiyi ShangICSE 2021 · 44 citations
- Where Shall We Log? Studying and Suggesting Logging Locations in Code BlocksZhenhao Li, Tse-Hsun Chen, Weiyi ShangASE 2020 · 41 citations
- Towards the use of the readily available tests from the release pipeline as performance tests: are we there yet?Zishuo Ding, Jinfu Chen, Weiyi ShangICSE 2020 · 33 citations
- Studying the use of Java logging utilities in the wildBoyuan Chen, Zhen Ming (Jack) JiangICSE 2020 · 28 citations
Related papers
- UniLog: Automatic Logging via LLM and In-Context LearningJunjielong Xu, Ziang Cui, Yuan Zhao, Xu Zhang et al.ICSE 2024 · 56 citations
- Deep Just-In-Time Inconsistency Detection Between Comments and Source CodeSheena Panthaplackel, Junyi Jessy Li, Milos Gligoric, Raymond J. MooneyAAAI 2021 · 62 citations
- How Do Developers' Profiles and Experiences Influence their Logging Practices? An Empirical Study of Industrial PractitionersGuoping Rong, Shenghui Gu, Haifeng Shen, He Zhang et al.ICSE 2023 · 4 citations
- When to Say What: Learning to Find Condition-Message InconsistenciesIslem Bouzenia, Michael PradelICSE 2023 · 5 citations
- Code Comment Inconsistency Detection and Rectification Using a Large Language ModelGuoping Rong, Yongda Yu, Song Liu, Xin Tan et al.ICSE 2025 · 4 citations
