ABSTRACT
Software logging is widely used in practice. Logs have been used for a variety of purposes like debugging, monitoring, security compliance, and business analytics. Instead of directly invoking the standard output functions, developers usually prefer to use logging utilities (LUs) (e.g., SLF4J), which provide additional functionalities like thread-safety and verbosity level support, to instrument their source code. Many of the previous research works on software logging are focused on the log printing code. There are very few works studying the use of LUs, although new LUs are constantly being introduced by companies and researchers. In this paper, we conducted a large-scale empirical study on the use of Java LUs in the wild. We analyzed the use of 3, 856 LUs from 11,194 projects in GitHub and found that many projects have complex usage patterns for LUs. For example, 75.8% of the large-sized projects have implemented their own LUs in their projects. More than 50% of these projects use at least three LUs. We conducted further qualitative studies to better understand and characterize the complex use of LUs. Our findings show that different LUs are used for a variety of reasons (e.g., internationalization of the log messages). Some projects develop their own LUs to satisfy project-specific logging needs (e.g., defining the logging format). Multiple uses of LUs in one project are pretty common for large and very largesized projects mainly for context like enabling and configuring the logging behavior for the imported packages. Interviewing with 13 industrial developers showed that our findings are also generally true for industrial projects and are considered as very helpful for them to better configure and manage the logging behavior for their projects. The findings and the implications presented in this paper will be useful for developers and researchers who are interested in developing and maintaining LUs.
- Apache Commons Logging. 2019. https://commons.apache.org/proper/commons-logging/. Last accessed: 07/23/2019.Google Scholar
- Apache Hadoop. 2019. https://hadoop.apache.org/. Last accessed: 08/22/2019.Google Scholar
- Apache Tomcat. 2019. http://tomcat.apache.org/. Last accessed: 08/22/2019.Google Scholar
- Sven Apel, Don Batory, Sven Apel, and Don Batory. 2008. How AspectJ is used: An analysis of eleven Aspectj programs. Journal of Object Technology (JOT) (2008).Google Scholar
- Lingfeng Bao, Xin Xia, David Lo, and Gail C. Murphy. 2019. A Large Scale Study of Long-Time Contributor Prediction for GitHub Projects. IEEE Transactions on Software Engineering (TSE) (2019).Google Scholar
- Titus Barik, Robert DeLine, Steven Drucker, and Danyel Fisher. 2016. The Bones of the System: A Case Study of Logging and Telemetry at Microsoft. In Companion Proceedings of the 38th International Conference on Software Engineering (ICSE-C), 2016.Google ScholarDigital Library
- Bitcoin Wallet. 2019. Bitcoin Wallet app for your Android device. https://github.com/bitcoin-wallet/bitcoin-wallet. Last accessed: 08/23/2019.Google Scholar
- Boyuan Chen and Zhen Ming (Jack) Jiang. 2016. Characterizing logging practices in Java-based open source software projects - a replication study in Apache Software Foundation. Empirical Software Engineering (EMSE) (2016).Google Scholar
- Boyuan Chen and Zhen Ming (Jack) Jiang. 2017. Characterizing and Detecting Anti-patterns in the Logging Code. In Proceedings of the 39th International Conference on Software Engineering (ICSE), 2017.Google ScholarDigital Library
- Boyuan Chen and Zhen Ming (Jack) Jiang. 2019. Extracting and studying the Logging-Code-Issue- Introducing changes in Java-based large-scale open source software systems. Empirical Software Engineering (EMSE) (2019).Google Scholar
- Rui Ding, Hucheng Zhou, Jian-Guang Lou, Hongyu Zhang, Qingwei Lin, Qiang Fu, Dongmei Zhang, and Tao Xie. 2015. Log2: A Cost-aware Logging Mechanism for Performance Diagnosis. In Proceedings of the 2015 Usenix Annual Technical Conference (ATC), 2015.Google Scholar
- Steve Easterbrook, Janice Singer, Margaret-Anne Storey, and Daniela Damian. 2008. Selecting Empirical Methods for Software Engineering Research.Google Scholar
- Eclipse Java IDE. 2019.. https://www.eclipse.org/ide/. Last accessed: 08/22/2019.Google Scholar
- Firebase. 2019. A mobile and web application development platform. https://firebase.google.com/. Last accessed: 08/23/2019.Google Scholar
- Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts. 1999. Refactoring: Improving the Design of Existing Code. Addison-Wesley Longman Publishing Co., Inc.Google ScholarDigital Library
- Qiang Fu, Jieming Zhu, Wenlu Hu, Jian-Guang Lou, Rui Ding, Qingwei Lin, Dongmei Zhang, and Tao Xie. 2014. Where Do Developers Log? An Empirical Study on Logging Practices in Industry. In Companion Proceedings of the 36th International Conference on Software Engineering (ICSE-C), 2014.Google Scholar
- GitHub features. 2019. https://github.com/features. Last accessed: 07/29/2019.Google Scholar
- Mathieu Goeminne and Tom Mens. 2015. Towards a survival analysis of database framework usage in Java projects. In Proceedings of 31st International Conference on Software Maintenance and Evolution (ICSME), 2015.Google ScholarDigital Library
- Google Flogger. 2019. A Fluent Logging API for Java. https://github.com/google/flogger. Last accessed: 07/23/2019.Google Scholar
- Georgios Gousios. 2013. The GHTorrent dataset and tool suite. In Proceedings of the 10th Working Conference on Mining Software Repositories (MSR), 2013.Google ScholarDigital Library
- Jiawei Han. 2005. Data Mining: Concepts and Techniques. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA.Google ScholarDigital Library
- Ahmed E. Hassan and Richard C. Holt. 2004. Using Development History Sticky Notes to Understand Software Architecture. In Proceedings of 12th International Workshop on Program Comprehension (IWPC), 2004,.Google Scholar
- Mehran Hassani, Weiyi Shang, Emad Shihab, and Nikolaos Tsantalis. 2018. Studying and detecting log-related issues. Empirical Software Engineering (EMSE) (2018).Google Scholar
- HBase. 2018. Apache HBase. https://hbase.apache.org. Last accessed: 01/29/2018.Google Scholar
- Pinjia He, Zhuangbin Chen, Shilin He, and Michael R. Lyu. 2018. Characterizing the Natural Language Descriptions in Software Logging Statements. In Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering (ASE), 2018.Google Scholar
- How to enable logging in dubbo? 2019. https://blog.csdn.net/JDream314/article/details/44620767. Last accessed: 08/21/2019.Google Scholar
- How to enable logging in Jetty. 2019. https://stackoverflow.com/questions/25786592/how-to-enable-logging-in-jettyt. Last accessed: 08/21/2019.Google Scholar
- Jez Humble and David Farley. 2010. Continuous Delivery: Reliable Software Releases Through Build, Test, and Deployment Automation. Addison-Wesley Professional.Google ScholarDigital Library
- IntelliJ IDEA. 2019. https://www.jetbrains.com/idea/. Last accessed: 08/22/2019.Google Scholar
- JBoss Logging. 2019. https://developer.jboss.org/wiki/JBossLoggingTooling. Last accessed: 07/16/2019.Google Scholar
- JDT Java Development Tools. 2019. https://eclipse.org/jdt/. Last accessed: 07/23/2019.Google Scholar
- Brittany Johnson, Yoonki Song, Emerson Murphy-Hill, and Robert Bowdidge. 2013. Why Don't Software Developers Use Static Analysis Tools to Find Bugs?. In Proceedings of the 35th International Conference on Software Engineering (ICSE), 2013.Google ScholarCross Ref
- Suhas Kabinna, Cor-Paul Bezemer, Weiyi Shang, and Ahmed E. Hassan. 2016. Logging Library Migrations: A Case Study for the Apache Software Foundation Projects. In Proceedings of the 13th International Conference on Mining Software Repositories (MSR), 2016.Google Scholar
- Eirini Kalliamvakou, Georgios Gousios, Kelly Blincoe, Leif Singer, Daniel German, and Daniela Damian. 2014. The Promises and Perils of Mining GitHub. In Proceedings of the 11th Working Conference on Mining Software Repositories (MSR), 2014.Google ScholarDigital Library
- Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. 1997. Aspect-oriented programming.Google Scholar
- Pavneet Singh Kochhar, Dinusha Wijedasa, and David Lo. 2016. A Large Scale Study of Multiple Programming Languages and Code Quality. In Proceedings of the 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER), 2016.Google ScholarCross Ref
- William H. Kruskal and W Allen Wallis. 1952. Use of Ranks in One-Criterion Variance Analysis. Journal of the American Statistical Association (JASA) (1952).Google Scholar
- Heng Li, Weiyi Shang, and Ahmed E. Hassan. 2017. Which Log Level Should Developers Choose for a New Logging Statement? Empirical Software Engineering (EMSE) (2017).Google Scholar
- Heng Li, Weiyi Shang, Ying Zou, and Ahmed E. Hassan. 2017. Towards just-in-time suggestions for log changes. Empirical Software Engineering (EMSE) (2017).Google Scholar
- Zhenhao Li, Tse-Hsun Chen, Jinqiu Yang, and Weiyi Shang. 2019. DLfinder: characterizing and detecting duplicate logging code smells. In Proceedings of the 41st International Conference on Software Engineering (ICSE), 2019.Google ScholarDigital Library
- Jimmy Lin and Dmitriy Ryaboy. 2012. Scaling big data mining infrastructure: the twitter experience. SIGKDD Explorations 14, 2 (2012), 6--19.Google ScholarDigital Library
- Log4J. 2019. A logging library for Java. http://logging.apache.org/log4j/1.2. Last accessed: 07/23/2019.Google Scholar
- LOG4J 2. 2019. Apache Log4j 2. http://logging.apache.org/log4j/2.x. Last accessed: 07/23/2019.Google Scholar
- log4net. 2019. log4net A logging library for .NET. https://logging.apache.org/log4net/. Last accessed: 07/23/2019.Google Scholar
- Logging dependency conflicts. 2019. https://cloud.tencent.com/developer/ask/121135. Last accessed: 08/21/2019.Google Scholar
- LogProvider in Ninja. 2019. https://github.com/ninjaframework/ninja. Last accessed: 08/22/2019.Google Scholar
- Cristina Lopes and Joel Ossher. 2015. How Scale Affects Structure in Java Programs. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2015.Google ScholarDigital Library
- Mark Marron. 2018. Log++ Logging for a Cloud-native World. In Proceedings of the 14th ACM SIGPLAN International Symposium on Dynamic Languages (DLS), 2018.Google ScholarDigital Library
- Maven plugin development guide. 2019. http://maven.apache.org/guides/plugin/guide-java-plugin-development.html. Last accessed: 08/23/2019.Google Scholar
- Multiple logging implementations found in Spring Boot. 2019. https://stackoverflow.com/questions/52911393/multiple-logging-implementations-found-in-spring-boot. Last accessed: 08/21/2019.Google Scholar
- Freddy Munoz, Benoit Baudry, Romain Delamare, and Yves Le Traon. 2013. Usage and Testability of AOP: An Empirical Study of AspectJ. Information and Software Technology (IST) (2013).Google Scholar
- OkHttp - an HTTP client for Android, Kotlin, and Java. 2019. https://github.com/square/okhttp. Last accessed: 08/23/2019.Google Scholar
- Adam Oliner, Archana Ganapathi, and Wei Xu. 2012. Advances and Challenges in Log Analysis. Communications of ACM (2012).Google Scholar
- Omni-Notes: note-taking application for Android. 2019. https://github.com/federicoiosue/Omni-Notes. Last accessed: 08/21/2019.Google Scholar
- Opentracing: vendor-neutral APIs and instrumentation for distributed tracing. 2019. https://opentracing.io/. Last accessed: 07/23/2019.Google Scholar
- Antonio Pecchia, Marcello Cinque, Gabriella Carrozza, and Domenico Cotroneo. 2015. Industry Practices and Event Logging: Assessment of a Critical Software Development Process. In Companion Proceedings of the 37th International Conference on Software Engineering (ICSE-C), 2015.Google ScholarCross Ref
- Liferay Portal. 2019. Liferay Portal - an open source enterprise web platform. https://github.com/liferay/liferay-portal. Last accessed: 08/22/2019.Google Scholar
- Baishakhi Ray, Daryl Posnett, Premkumar Devanbu, and Vladimir Filkov. 2017. A Large-scale Study of Programming Languages and Code Quality in GitHub. Communications of the ACM (2017).Google Scholar
- Red Hat Wildfly. 2019. https://wildfly.org/. Last accessed: 08/22/2019.Google Scholar
- Mohammed Sayagh, Noureddine Kerzazi, Bram Adams, and Fabio Petrillo. 2018. Software Configuration Engineering in Practice: Interviews, Survey, and Systematic Literature Review. IEEE Transactions on Software Engineering (TSE) (2018).Google Scholar
- Sentry - cross-platform application monitoring, with a focus on error reporting. 2019. https://sentry.io. Last accessed: 08/23/2019.Google Scholar
- Weiyi Shang, Zhen Ming Jiang, Bram Adams, Ahmed E. Hassan, Michael W. Godfrey, Mohamed Nasser, and Parminder Flora. 2014. An exploratory study of the evolution of communicated information about the execution of large software systems. Journal of Software: Evolution and Process (JSEP) (2014).Google Scholar
- Weiyi Shang, Meiyappan Nagappan, and Ahmed E. Hassan. 2015. Studying the relationship between logging characteristics and the code quality of platform software. Empirical Software Engineering (EMSE) (2015).Google Scholar
- Simple Logging Facade for Java (SLF4J). 2019. https://www.slf4j.org/. Last accessed: 08/12/2019.Google Scholar
- spdlog - Very fast, header-only/compiled, C++ logging library. 2019. https://github.com/gabime/spdlog. Last accessed: 07/23/2019.Google Scholar
- Spring Boot pull request 4341. 2019. https://github.com/spring-projects/spring-boot/issues/4341. Last accessed: 08/21/2019.Google Scholar
- Spring Cloud Sleuth. 2019. https://spring.io/projects/spring-cloud-sleuth. Last accessed: 08/23/2019.Google Scholar
- StackOverflow: Disable Logback in SpringBoot. 2019. https://stackoverflow.com/questions/23984009/disable-logback-in-springboot/23991715. Last accessed: 08/01/2019.Google Scholar
- Telegram - a cloud-based instant messaging service. 2019. https://github.com/DrKLO/Telegram. Last accessed: 08/21/2019.Google Scholar
- The replication package. 2020. https://www.eecs.yorku.ca/~chenfsd/resources/icse2020_replication.zip. Last accessed: 01/26/2020.Google Scholar
- The State of Logging in Java. 2019. https://stackify.com/logging-java/. Last accessed: 08/21/2019.Google Scholar
- Timber - a logger with a small, extensible API which provides utility on top of Android's normal Log class. 2019. https://github.com/JakeWharton/timber. Last accessed: 08/23/2019.Google Scholar
- TIOBE Index for August 2019. 2019. https://www.tiobe.com/tiobe-index/. Last accessed: 07/23/2019.Google Scholar
- Ultimate Guide to Logging. 2019. https://www.loggly.com/ultimate-guide/java-logging-basics/. Last accessed: 08/21/2019.Google Scholar
- Vertx - a tool-kit for building reactive applications on the JVM. 2019. https://github.com/eclipse-vertx/vert.x. Last accessed: 08/23/2019.Google Scholar
- What's Up with Logging in Java? 2019. https://stackoverflow.com/questions/354837/whats-up-with-logging-in-java. Last accessed: 07/23/2019.Google Scholar
- Why not use java.util.logging? 2019. https://stackoverflow.com/questions/11359187/why-not-use-java-util-logging. Last accessed: 07/23/2019.Google Scholar
- Stephen Yang, Seo Jin Park, and John Ousterhout. 2018. NanoLog: A Nanosecond Scale Logging System. In Proceedings of the 2018 USENIX Annual Technical Conference (ATC), 2018.Google Scholar
- Ding Yuan, Haohui Mai, Weiwei Xiong, Lin Tan, Yuanyuan Zhou, and Shankar Pasupathy. 2010. SherLog: error diagnosis by connecting clues from run-time logs. In Proceedings of the 15th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2010.Google ScholarDigital Library
- Ding Yuan, Soyeon Park, Peng Huang, Yang Liu, Michael M. Lee, Xiaoming Tang, Yuanyuan Zhou, and Stefan Savage. 2012. Be Conservative: Enhancing Failure Diagnosis with Proactive Logging. In Proceedings of the 10th USENIX Conference on Operating Systems Design and Implementation (OSDI), 2012.Google Scholar
- Ding Yuan, Soyeon Park, and Yuanyuan Zhou. 2012. Characterizing Logging Practices in Open-source Software. In Proceedings of the 34th International Conference on Software Engineering (ICSE), 2012.Google ScholarDigital Library
- Ding Yuan, Jing Zheng, Soyeon Park, Yuanyuan Zhou, and Stefan Savage. 2011. Improving Software Diagnosability via Log Enhancement. In Proceedings of the 16th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2011.Google ScholarDigital Library
- Yi Zeng, Jinfu Chen, Weiyi Shang, and Tse-Hsun (Peter) Chen. 2019. Studying the characteristics of logging practices in mobile apps: a case study on F-Droid. Empirical Software Engineering (EMSE) (2019).Google Scholar
- Ahmed Zerouali and Tom Mens. 2017. Analyzing the evolution of testing library usage in open source Java projects. In Proceedings of the 24th International Conference on Software Analysis, Evolution and Reengineering (SANER), 2017.Google ScholarCross Ref
- Xu Zhao, Kirk Rodrigues, Yu Luo, Michael Stumm, Ding Yuan, and Yuanyuan Zhou. 2017. Log20: Fully Automated Optimal Placement of Log Printing Statements Under Specified Overhead Threshold. In Proceedings of the 26th Symposium on Operating Systems Principles (SOSP), 2017.Google ScholarDigital Library
- Chen Zhi, Jianwei Yin, Shuiguang Deng, Maoxin Ye, Min Fu,, and Tao Xie. 2019. An Exploratory Study of Logging Configuration Practice in Java. In In Proceedings of the 35th IEEE International Conference on Software Maintenance and Evolution (ICSME), 2019.Google Scholar
- Jieming Zhu, Pinjia He, Qiang Fu, Hongyu Zhang, Michael R. Lyu, and Dongmei Zhang. 2015. Learning to Log: Helping Developers Make Informed Logging Decisions. In Proceedings of the 37th International Conference on Software Engineering (ICSE), 2015.Google ScholarCross Ref
- Jieming Zhu, Shilin He, JinyangLiu, Pinjia He, Qi Xie, Zibin Zheng, and Michael R. Lyu. 2019. Tools and benchmarks for automated log parsing. In Proceedings of the 41st International Conference on Software Engineering: Software Engineering in Practice, (ICSE-SEIP), 2019.Google Scholar
Recommendations
Characterizing and detecting anti-patterns in the logging code
ICSE '17: Proceedings of the 39th International Conference on Software EngineeringSnippets of logging code are output statements (e.g., LOG.info or System.out.println) that developers insert into a software system. Although more logging code can provide more execution context of the system's behavior during runtime, it is undesirable ...
Studying logging practice in test code
AbstractLogging is widely used in modern software development to record run-time information for software systems and plays a significant role in software testing. Although the research area of logging has attracted much attention, little attention is ...
Extracting and studying the Logging-Code-Issue- Introducing changes in Java-based large-scale open source software systems
Execution logs, which are generated by logging code, are widely used in modern software projects for tasks like monitoring, debugging, and remote issue resolution. Ineffective logging would cause confusion, lack of information during problem diagnosis, ...
Comments