Studying Duplicate Logging Statements and Their Relationships with Code Clones
Not on the map. Why?
Abstract (arXiv)
In this paper, we focus on studying duplicate logging statements, which are logging statements that have the same static text message. We manually studied over 4K duplicate logging statements and their surrounding code in five large-scale open source systems. We uncovered five patterns of duplicate logging code smells. For each instance of the duplicate logging code smell, we further manually identify the potentially problematic and justifiable cases. Then, we contact developers to verify our manual study result. We integrated our manual study result and the feedback of developers into our automated static analysis tool, DLFinder, which automatically detects problematic duplicate logging code smells. We evaluated DLFinder on the five manually studied systems and three additional systems. In total, combining the results of DLFinder and our manual analysis, we reported 91 problematic duplicate logging code smell instances to developers and all of them have been fixed. We further study the relationship between duplicate logging statements, including the problematic instances of duplicate logging code smells, and code clones. We find that 83% of the duplicate logging code smell instances reside in cloned code, but 17% of them reside in micro-clones that are difficult to detect using automated clone detection tools. We also find that more than half of the duplicate logging statements reside in cloned code snippets, and a large portion of them reside in very short code blocks which may not be effectively detected by existing code clone detection tools. Our study shows that, in addition to general source code that implements the business logic, code clones may also result in bad logging practices that could increase maintenance difficulties.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). First posted on arXiv 1 Jun 2021.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 3; 2022: 1; 2023: 0; 2024: 1.
5 papers.
- 2024NLPerturbator: Studying the Robustness of Code LLMs to Natural Language Variationscited by 19
- 2021A Comprehensive Survey of Logging in Software: From Logging Statements Automation to Log Mining and Analysiscited by 6
- 2021Leveraging Code Clones and Natural Language Processing for Log Statement Predictioncited by 1
- 2022Data-Driven Approach for Log Instruction Quality Assessmentcited by 1
- 2021Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automationcited by 0
- 2024NLPerturbator: Studying the Robustness of Code LLMs to Natural Language Variations28 Jun 2024
- 2022Data-Driven Approach for Log Instruction Quality Assessment6 Apr 2022
- 2021Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automation2 Dec 2021
- 2021A Comprehensive Survey of Logging in Software: From Logging Statements Automation to Log Mining and Analysis24 Oct 2021
- 2021Leveraging Code Clones and Natural Language Processing for Log Statement Prediction8 Sep 2021