log4r
A fast & lightweight approach to logging in R based on the widely-emulated Apache Log4j project
log4r is a fast, lightweight logging package for R based on Apache Log4j. It provides object-oriented logging functionality through logger objects that can write messages to multiple destinations like files, consoles, or centralized logging systems.
The package prioritizes performance and simplicity over feature bloat while remaining extensible through customizable appenders and layouts. It offers first-class support for structured logging, allowing you to add contextual fields to log messages beyond simple text strings. Unlike other R logging packages, log4r focuses on speed and maintains a clean API for common logging patterns.
Contributors#
Resources featuring log4r#
Why You Should Add Logging To Your Code (and make it more helpful) - posit::conf(2023)
Presented by Daren Eiri
Learn how the log4r package can help you better understand the errors your code may produce, and how to also get promptly alerted for severe errors by leveraging cloud monitoring solutions like Azure Monitor or AWS CloudWatch
When an error happens in your API, Shiny App, or quarto document, it is not always clear what line of code you need to look at, and the error messages aren’t always helpful. By walking through a simple API example, I show how you can use logging packages like log4r to provide error messages that make sense to you. I also show how you can use cloud-based data collection platforms like Azure Monitor or AWS CloudWatch to set up alerts, so you can get notified by email or text message for those severe errors that you need to be immediately aware of.
Gain more visibility into the health of your code by incorporating logging and pushing your logs to the cloud.
Materials: https://dareneiri.github.io/positconf2023/
Presented at Posit Conference, between Sept 19-20 2023, Learn more at posit.co/conference.#
Talk Track: Lightning talks. Session Code: TALK-1164