Logging plays a crucial role in software engineering because it is key to perform various tasks including debugging, performance analysis, and detection of anomalies. Despite the importance of log data, the practice of logging still suffers from the lack of common guidelines and best practices. Recent studies investigated logging in C/C++ and Java open-source systems. In this paper, we complement these studies by conducting the first empirical study on logging practices in the Linux kernel, one of the most elaborate open-source development projects in the computer industry. We analyze 22 Linux releases with a focus on three main aspects: the pervasiveness of logging in Linux, the types of changes made to logging statements, and the rationale behind these changes. Our findings show that logging code accounts for 3.73% of the total source code in the Linux kernel, distributed across 72.36% of Linux files. We also found that the distribution of logging statements across Linux subsystems and their components vary significantly with no apparent reasons, suggesting that developers use different criteria when logging. In addition, we observed a slow decrease in the use of logging-reduction of 9.27% between versions v4.3 and v5.3. The majority of changes in logging code are made to fix language issues, modify log levels, and upgrade logging code to use new logging libraries, with the overall goal of improving the precision and consistency of the log output. Many recommendations are derived from our findings such as the use of static analysis tools to detect log-related issues, the adoption of common writing styles to improve the quality of log messages, the development of conventions to guide developers when selecting log levels, the establishment of review sessions to review logging code, and so on. [...]
翻译:记录在软件工程中发挥着关键作用,因为它是执行各种任务的关键,包括调试、绩效分析和发现异常现象。尽管日志数据很重要,但伐木做法仍然缺乏共同准则和最佳做法。最近的研究调查了C/C++和爪哇开放源代码系统的伐木。在本文件中,我们通过对Linux核心库(计算机行业最复杂的开放源开发项目之一)的伐木做法进行第一次经验研究来补充这些研究。我们分析了22个Linux版本,重点是三个主要方面:Linux的伐木普遍、对伐木报表的变更类型以及这些变更背后的理由。我们的调查结果显示,Linux核心库总源代码的3.73%的伐木。在Linux文件的72.36%中分布。 我们还发现,Linux核心核心核心库的伐木做法及其组成部分的分布差异很大,没有明显的原因表明,开发者在伐木时使用不同的标准。 此外,我们发现,在使用Linux系统的质量指南时,在Linux系统内部的伐木记录减少9.27%,在记录报表的版本v4.3和v5.3中的变化,对Linux总源代码进行审评的修改是,在记录中,对伐木数据进行新的修改,在更新到更新到更新到更新到更新的逻辑的逻辑的逻辑值值值值值值值值值值值值值值值值值值值值的修改到更新到更新到更新到更新到更新到更新到更新到更新到更新到更新到更新到更新到伐木值值值值中,对值值值值值值值值值值值值值值值值值值的修改到更新到更新到更新到更新到更新到更新到更新到更新到更新到更新到更新到更新到更新到记录到记录到记录到更新到更新到更新到更新到更新到更新到更新到更新到更新到记录到更新到记录到记录到记录到记录到记录到记录到更新到更新到更新到更新到记录到记录到更新到更新到更新到更新到更新到更新到更新到对值值值值值值的修改到更新到更新到更新到更新到更新到更新到记录的修改到记录的修改到更新到更新到更新到更新到更新到记录到记录到记录到记录到更新到记录到记录到记录到更新到更新的修改到更新到更新到更新