Where Shall We Log? Studying and Suggesting Logging Locations in Code Blocks
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 85.6% 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.
Conference DayWed 23 SepDisplayed time zone: (UTC) Coordinated Universal Time change
00:00 - 01:00
|A Deep Multitask Learning Approach for Requirements Discovery and Annotation from Open Forum|
|Retrieve and Refine: Exemplar-based Neural Comment Generation|
Bolin WeiPeking University, Yongmin LiPeking University, Ge LiPeking University, Xin XiaMonash University, Zhi JinPeking UniversityPre-print
|Where Shall We Log? Studying and Suggesting Logging Locations in Code Blocks|