Logs are significant in modern software systems, aiding in various maintenance tasks. To make better use of these logs, many methods have been proposed to help developers draft suitable logging statements. However, these methods only help developers either locate logging positions or write partial content of logging statements, or cannot efficiently help in generating and inserting complete logging statements. To address their limitations, we introduce a new method to better support the automated end-to-end generation of logging statements. Our end-to-end method consists of two steps, first utilizing token classification to locate where to insert a logging statement, and then employing a Seq2Seq model to generate a complete logging statement with a log level and a log message for that position. We evaluate our proposed method on the previously used benchmark and a self-constructed new benchmark. The experimental results show that our method outperforms the state-of-the-art approach a lot regarding both generation speed and quality.
翻译:暂无翻译