Where Shall We Log? Studying and Suggesting Logging Locations in Code Blocks
Zhenhao Li, Tse-Hsun Chen, Weiyi Shang
摘要
Developers write logging statements to generate logs and record system execution behaviors to assist in debugging and software maintenance. However, deciding where to insert logging statements is a crucial yet challenging task. On one hand, logging too little may increase the maintenance difficulty due to missing important system execution information. On the other hand, logging too much may introduce excessive logs that mask the real problems and cause significant performance overhead. Prior studies provide recommendations on logging locations, but such recommendations are only for limited situations (e.g., exception logging) or at a coarse-grained level (e.g., method level). Thus, properly helping developers decide finer-grained logging locations for different situations remains an unsolved challenge. In this paper, we tackle the challenge by first conducting a comprehensive manual study on the characteristics of logging locations in seven open-source systems. We uncover six categories of logging locations and find that developers usually insert logging statements to record execution information in various types of code blocks. Based on the observed patterns, we then propose a deep learning framework to automatically suggest logging locations at the block level. We model the source code at the code block level using the syntactic and semantic information. We find that: 1) our models achieve an average of 80.1% balanced accuracy when suggesting logging locations in blocks; 2) our cross-system logging suggestion results reveal that there might be an implicit logging guideline across systems. Our results show that we may accurately provide finer-grained suggestions on logging locations, and such suggestions may be shared across systems.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 15 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Using Deep Learning to Generate Complete Log Statements 引用了 DeepLV: Suggesting Log Levels Using Ordinal Based Neural Networks
- Did We Miss Something Important? Studying and Exploring Variable-Aware Log Abstraction 引用了 TeLL: log level suggestions via modeling multi-level code block information
- Did We Miss Something Important? Studying and Exploring Variable-Aware Log Abstraction 引用了 DeepLV: Suggesting Log Levels Using Ordinal Based Neural Networks
- Go Static: Contextualized Logging Statement Generation 引用了 Using Deep Learning to Generate Complete Log Statements
- Go Static: Contextualized Logging Statement Generation 引用了 TeLL: log level suggestions via modeling multi-level code block information
- Go Static: Contextualized Logging Statement Generation 引用了 DeepLV: Suggesting Log Levels Using Ordinal Based Neural Networks
- TeLL: log level suggestions via modeling multi-level code block information 引用了 Studying the use of Java logging utilities in the wild
- TeLL: log level suggestions via modeling multi-level code block information 引用了 DeepLV: Suggesting Log Levels Using Ordinal Based Neural Networks
引用它的顶会 Paper15
- Using Deep Learning to Generate Complete Log StatementsAntonio Mastropaolo, Luca Pascarella, Gabriele BavotaICSE 2022 · 60 次引用
- DeepLV: Suggesting Log Levels Using Ordinal Based Neural NetworksZhenhao Li, Heng Li, Tse-Hsun Peter Chen, Weiyi ShangICSE 2021 · 44 次引用
- Did We Miss Something Important? Studying and Exploring Variable-Aware Log AbstractionZhenhao Li, Chuan Luo, Tse-Hsun Chen, Weiyi Shang 等ICSE 2023 · 41 次引用
- TeLL: log level suggestions via modeling multi-level code block informationJiahao Liu, Jun Zeng, Xiang Wang, Kaihang Ji 等ISSTA 2022 · 20 次引用
- Go Static: Contextualized Logging Statement GenerationYichen Li, Yintong Huo, Renyi Zhong, Zhihan Jiang 等FSE 2024 · 17 次引用
它引用的 Paper2
相关 Paper
- Are They All Good? Studying Practitioners' Expectations on the Readability of Log MessagesZhenhao Li, An Ran Chen, Xing Hu, Xin Xia 等ASE 2023 · 6 次引用
- FastLog: An End-to-End Method to Efficiently Generate and Insert Logging StatementsXiaoyuan Xie, Zhipeng Cai, Songqiang Chen, Jifeng XuanISSTA 2024 · 3 次引用
- UniLog: Automatic Logging via LLM and In-Context LearningJunjielong Xu, Ziang Cui, Yuan Zhao, Xu Zhang 等ICSE 2024 · 56 次引用
- How Do Developers' Profiles and Experiences Influence their Logging Practices? An Empirical Study of Industrial PractitionersGuoping Rong, Shenghui Gu, Haifeng Shen, He Zhang 等ICSE 2023 · 4 次引用
- Defects4Log: Benchmarking LLMs for Logging Code Defect Detection and ReasoningXin Wang, Zhenhao Li, Zishuo DingASE 2025 · 1 次引用
