Studying Duplicate Logging Statements and Their Relationships with Code Clones

06/01/2021
by   Zhenhao Li, et al.
0

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 code, but 17 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.

READ FULL TEXT

page 10

page 18

research
09/02/2021

APIzation: Generating Reusable APIs from StackOverflow Code Snippets

Developer forums like StackOverflow have become essential resources to m...
research
07/15/2020

On the Generation, Structure, and Semantics of Grammar Patterns in Source Code Identifiers

Identifiers make up a majority of the text in code. They are one of the ...
research
08/05/2020

Antibody Watch: Text Mining Antibody Specificity from the Literature

Motivation: Antibodies are widely used reagents to test for expression o...
research
10/06/2022

Tracking the Evolution of Static Code Warnings: the State-of-the-Art and a Better Approach

Static bug detection tools help developers detect problems in the code, ...
research
03/16/2022

Code Smells in Elixir: Early Results from a Grey Literature Review

Elixir is a new functional programming language whose popularity is risi...
research
12/02/2021

Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automation

Software developers embed logging statements inside the source code as a...
research
09/08/2021

Leveraging Code Clones and Natural Language Processing for Log Statement Prediction

Software developers embed logging statements inside the source code as a...

Please sign up or login with your details

Forgot password? Click here to reset