LogUpdater: Automated Detection and Repair of Specific Defects in Logging Statements

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Zhong, Renyi, Li, Yichen, Kuang, Jinxi, Gu, Wenwei, Huo, Yintong, Lyu, Michael R.
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866917993408102400
author Zhong, Renyi
Li, Yichen
Kuang, Jinxi
Gu, Wenwei
Huo, Yintong
Lyu, Michael R.
author_facet Zhong, Renyi
Li, Yichen
Kuang, Jinxi
Gu, Wenwei
Huo, Yintong
Lyu, Michael R.
contents Developers use logging statements to track software runtime behaviors and system status. Yet, unclear or misleading logs can hide true execution patterns and hinder software maintenance. Current research on logging statement issues is limited, often only spotting one defect type and relying on manual corrections instead of automation. To bridge this gap, we conduct a study to identify four logging statement defect types by analyzing log-centric changes. Then we introduce LogUpdater, a two-stage framework for automatically detecting and updating these log defects. In the offline phase, LogUpdater builds a classifier using synthetic defective logs to spot defect types. During online testing, this classifier assesses if and how logs in code snippets need improvement. LogUpdater then uses type-aware prompts from past logging updates to suggest fixes via a recommendation framework based on LLMs. Results show strong defect detection with an F1 score of 0.625. It also greatly improves static text and dynamic variable suggestions by 48.12% and 24.90%, respectively. LogUpdater successfully recommends updates 61.49% of the time on new projects. We reported 40 problematic logs and their fixes on GitHub, leading to 25 merged changes across 11 projects.
format Preprint
id arxiv_https___arxiv_org_abs_2408_03101
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle LogUpdater: Automated Detection and Repair of Specific Defects in Logging Statements
Zhong, Renyi
Li, Yichen
Kuang, Jinxi
Gu, Wenwei
Huo, Yintong
Lyu, Michael R.
Software Engineering
Developers use logging statements to track software runtime behaviors and system status. Yet, unclear or misleading logs can hide true execution patterns and hinder software maintenance. Current research on logging statement issues is limited, often only spotting one defect type and relying on manual corrections instead of automation. To bridge this gap, we conduct a study to identify four logging statement defect types by analyzing log-centric changes. Then we introduce LogUpdater, a two-stage framework for automatically detecting and updating these log defects. In the offline phase, LogUpdater builds a classifier using synthetic defective logs to spot defect types. During online testing, this classifier assesses if and how logs in code snippets need improvement. LogUpdater then uses type-aware prompts from past logging updates to suggest fixes via a recommendation framework based on LLMs. Results show strong defect detection with an F1 score of 0.625. It also greatly improves static text and dynamic variable suggestions by 48.12% and 24.90%, respectively. LogUpdater successfully recommends updates 61.49% of the time on new projects. We reported 40 problematic logs and their fixes on GitHub, leading to 25 merged changes across 11 projects.
title LogUpdater: Automated Detection and Repair of Specific Defects in Logging Statements
topic Software Engineering
url https://arxiv.org/abs/2408.03101