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.
Wed 23 SepDisplayed time zone: (UTC) Coordinated Universal Time change
00:00 - 01:00 | AI for Software Engineering (2)Research Papers at Koala Chair(s): Tse-Hsun (Peter) Chen Concordia University | ||
00:00 20mTalk | A Deep Multitask Learning Approach for Requirements Discovery and Annotation from Open Forum Research Papers Mingyang Li ISCAS, Lin Shi ISCAS, Ye Yang Stevens institute of technology, Qing Wang Institute of Software, Chinese Academy of Sciences | ||
00:20 20mTalk | Retrieve and Refine: Exemplar-based Neural Comment Generation Research Papers Bolin Wei Peking University, Yongmin Li Peking University, Ge Li Peking University, Xin Xia Monash University, Zhi Jin Peking University Pre-print | ||
00:40 20mTalk | Where Shall We Log? Studying and Suggesting Logging Locations in Code Blocks Research Papers Zhenhao Li Concordia University, Tse-Hsun (Peter) Chen Concordia University, Weiyi Shang Concordia University |