SEJun 1, 2021

Studying Duplicate Logging Statements and Their Relationships with Code Clones

arXiv:2106.00339v130 citationsHas Code
Originality Incremental advance
AI Analysis

This work addresses maintenance difficulties in software development by revealing how code clones contribute to bad logging practices, though it is incremental as it builds on existing logging and clone detection research.

The paper studied duplicate logging statements in large-scale open source systems, identifying five patterns of code smells and developing an automated tool, DLFinder, which detected 91 problematic instances that were all fixed by developers. It also found that 83% of these instances reside in cloned code, but 17% are in micro-clones hard to detect with existing tools.

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.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes