论文标题
使用深度学习生成完整的日志语句
Using Deep Learning to Generate Complete Log Statements
论文作者
论文摘要
记录是在软件生命周期的几个阶段广泛采用的实践。例如,在软件开发日志语句中,工程师可以通过公开运行软件的细粒度信息来验证和调试系统。虽然记录的好处是无可争议的,但要正确决定注入日志语句的位置,登录哪些信息以及在哪个日志级别(例如,错误,警告)对于记录效率至关重要。在本文中,我们介绍了Lance(Log Satect Specter推荐),这是第一种支持开发人员在所有这些决定中的方法。 Lance具有文本到文本转移转换器(T5)模型,该模型已通过6,894,456 Java方法进行了培训。兰斯(Lance)将其作为输入方法,并在其中注入一个完整的日志语句,包括人类可透明的日志记录消息,并正确选择所需的日志级别和语句位置。我们的结果表明,Lance能够(i)正确识别代码中的位置,以在65.9%的Java方法中注入该语句的位置; (ii)在66.2%的病例中选择适当的日志水平; (iii)生成一个完全正确的日志语句,其中包括15.2%的情况下的有意义的日志记录消息。
Logging is a practice widely adopted in several phases of the software lifecycle. For example, during software development log statements allow engineers to verify and debug the system by exposing fine-grained information of the running software. While the benefits of logging are undisputed, taking proper decisions about where to inject log statements, what information to log, and at which log level (e.g., error, warning) is crucial for the logging effectiveness. In this paper, we present LANCE (Log stAtemeNt reCommEnder), the first approach supporting developers in all these decisions. LANCE features a Text-To-Text-Transfer-Transformer (T5) model that has been trained on 6,894,456 Java methods. LANCE takes as input a Java method and injects in it a full log statement, including a human-comprehensible logging message and properly choosing the needed log level and the statement location. Our results show that LANCE is able to (i) properly identify the location in the code where to inject the statement in 65.9% of Java methods requiring it; (ii) selecting the proper log level in 66.2% of cases; and (iii) generate a completely correct log statement including a meaningful logging message in 15.2% of cases.