借鉴相似代码:基于深度学习NLP的日志语句自动化方法
Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automation
摘要:
软件开发人员将日志记录语句嵌入源代码中,作为现代软件开发中的一项重要职责,因为日志文件对于跟踪运行时系统问题和故障排除系统管理任务是必要的。然而,当前的日志记录过程大多是手动的,因此,日志记录语句的正确放置和内容仍然是一个挑战。为了克服这些挑战,旨在自动化日志放置并预测其内容的方法,即,“在哪里和什么日志”,是高度感兴趣的。因此,我们专注于预测位置(即,其中)和描述(即,通过利用源代码克隆和自然语言处理(NLP),为日志语句提供了更多的上下文和优势。具体来说,我们用三个研究问题(RQ)来指导我们的研究:(RQ 1)如何相似的代码片段,即,代码克隆,可用于日志语句预测?(RQ2)如何将该方法扩展到日志语句描述的自动化?以及(RQ3)所提出的方法对于原木定位和描述预测的有效性如何?为了追求我们的RQ,我们对七个开源Java项目进行了实验研究。我们引入了一个更新和改进的日志感知代码克隆检测方法来预测日志语句的位置(RQ 1)。然后,我们结合自然语言处理(NLP)和深度学习方法来自动化日志语句的描述预测(RQ 2)。我们的分析表明,我们的混合NLP和代码克隆检测方法(NLP CC'd)比传统的克隆检测器平均查找日志语句位置高出15.60%,并且与先前的研究(RQ 3)相比,在预测日志语句描述的BLEU和ROUGE得分上,性能提高了40.86%。
英文摘要:
Software developers embed logging statements inside the source code as an imperative duty in modern software development as log files are necessary for tracking down runtime system issues and troubleshooting system management tasks. However, the current logging process is mostly manual, and thus, proper placement and content of logging statements remain as challenges. To overcome these challenges, methods that aim to automate log placement and predict its content, i.e., 'where and what to log', are of high interest. Thus, we focus on predicting the location (i.e., where) and description (i.e., what) for log statements by utilizing source code clones and natural language processing (NLP), as these approaches provide additional context and advantage for log prediction. Specifically, we guide our research with three research questions (RQs): (RQ1) how similar code snippets, i.e., code clones, can be leveraged for log statements prediction? (RQ2) how the approach can be extended to automate log statements' descriptions? and (RQ3) how effective the proposed methods are for log location and description prediction? To pursue our RQs, we perform an experimental study on seven open-source Java projects. We introduce an updated and improved log-aware code-clone detection method to predict the location of logging statements (RQ1). Then, we incorporate natural language processing (NLP) and deep learning methods to automate the log statements' description prediction (RQ2). Our analysis shows that our hybrid NLP and code-clone detection approach (NLP CC'd) outperforms conventional clone detectors in finding log statement locations on average by 15.60% and achieves 40.86% higher performance on BLEU and ROUGE scores for predicting the description of logging statements when compared to prior research (RQ3).
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。