一句话:通过实证研究归纳块级日志位置模式,并提出深度学习框架自动推荐日志插入位置。
论文关注日志语句插入位置难以决策的问题:日志过少会丢失关键执行信息,过多则掩盖问题并带来性能开销。已有建议多局限于异常日志或方法级粒度。作者首先对七个开源系统进行人工研究,归纳出六类日志位置,发现开发者常在多种代码块中记录执行信息;随后提出基于代码块句法与语义信息的深度学习框架,自动推荐块级日志位置。实验显示模型平均平衡准确率达 80.1%,跨系统推荐结果还表明系统间可能存在隐式日志规范,说明更细粒度且可跨系统共享的日志位置建议是可行的。
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.
DOI 原文 ·
@inproceedings{paperbot5879,
title = {Where shall we log?},
author = {Zhenhao Li and Tse-Hsun (Peter) Chen and Weiyi Shang},
booktitle = {ASE},
year = {2020},
doi = {10.1145/3324884.3416636}
}