Affiliation:
1. University of Waterloo, Canada
2. Rochester Institute of Technology, USA
3. Polytechnique Montréal, Canada
Abstract
Developers insert logging statements in the source code to collect important runtime information about software systems. The textual descriptions in logging statements (i.e., logging texts) are printed during system executions and exposed to multiple stakeholders including developers, operators, users, and regulatory authorities. Writing proper logging texts is an important but often challenging task for developers. Prior studies find that developers spend significant efforts modifying their logging texts. However, despite extensive research on automated logging suggestions, research on suggesting logging texts rarely exists. To fill this knowledge gap, we first propose
LoGenText
(initially reported in our conference paper), an automated approach that uses neural machine translation (NMT) models to generate logging texts by translating the related source code into short textual descriptions.
LoGenText
takes the preceding source code of a logging text as the input and considers other context information, such as the location of the logging statement, to automatically generate the logging text.
LoGenText
’s evaluation on 10 open source projects indicates that the approach is promising for automatic logging text generation and significantly outperforms the state-of-the-art approach. Furthermore, we extend
LoGenText
to
LoGenText-Plus
by incorporating the syntactic templates of the logging texts. Different from
LoGenText
,
LoGenText-Plus
decomposes the logging text generation process into two stages.
LoGenText-Plus
first adopts an NMT model to generate the syntactic template of the target logging text. Then
LoGenText-Plus
feeds the source code and the generated template as the input to another NMT model for logging text generation. We also evaluate
LoGenText-Plus
on the same 10 projects and observe that it outperforms
LoGenText
on 9 of them. According to a human evaluation from developers’ perspectives, the logging texts generated by
LoGenText-Plus
have a higher quality than those generated by
LoGenText
and the prior baseline approach. By manually examining the generated logging texts, we then identify five aspects that can serve as guidance for writing or generating good logging texts. Our work is an important step toward the automated generation of logging statements, which can potentially save developers’ efforts and improve the quality of software logging. Our findings shed light on research opportunities that leverage advances in NMT techniques for automated generation and suggestion of logging statements.
Publisher
Association for Computing Machinery (ACM)
Reference104 articles.
1. Ruchit Agrawal, Marco Turchi, and Matteo Negri. 2018. Contextual handling in neural machine translation: Look behind, ahead and on both sides. In Proceedings of the 21st Annual Conference of the European Association for Machine Translation (EAMT’18). http://rua.ua.es/dspace/handle/10045/76016
2. A Transformer-based approach for source code summarization;Ahmad Wasi Uddin;arXiv preprint arXiv:2005.00653,2020
3. code2vec: learning distributed representations of code
4. T. Barik, R. DeLine, S. Drucker, and D. Fisher. 2016. The bones of the system: A case study of logging and telemetry at Microsoft. In Proceedings of the 2016 IEEE/ACM 38th International Conference on Software Engineering Companion (ICSE Companion’16). 92–101.
5. Evaluating Discourse Phenomena in Neural Machine Translation
Cited by
2 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. FastLog: An End-to-End Method to Efficiently Generate and Insert Logging Statements;Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis;2024-09-11
2. Go Static: Contextualized Logging Statement Generation;Proceedings of the ACM on Software Engineering;2024-07-12