About

Purpose

I wrote this document to provide in-depth information for a five-minute lighting talk I gave at the Posit::Conf(2023) conference in Chicago, IL (September 19, 2023).

View the presentation slides

With only five minutes to talk about logging, there is so much more information I wanted to share that I just could not get to. I hope others find this information helpful. This is knowledge I have gained through trial and error, and finding a solution that worked well for me. Maybe this information does not apply to you. And if you find the information not helpful or incorrect, then please let me know!

This documentation is also written from a perspective of having to service Shiny apps, Plumber APIs, and scheduled markdowns in a production environment, for business purposes. You may encounter advice in here that does not apply to you.

Section Overview

I have split up my content into separate sections for easier reading.

  1. Introduction to Logging: I discuss what logging is, why it can be useful, and some examples that demonstrate its purpose
  2. Logging Packages: I review a few logging packages I have found helpful. It is not meant to review all types of logging packages available.
  3. Logging Levels: I dive into different logging levels, such as INFO, WARN, and ERROR, and how to strategically use them. I also discuss why you should not log everything, and how you need to be strategic in what you log.
  4. Making Logs Accessible: I discuss how you can review your logs, either through writing to a local log file on your computer, or through cloud-based solutions. I focus on Azure.
  5. Condition Handling With Logging: Dive into what conditions are and how they’re useful in logging things.
  6. Configure Sending Syslogs to Azure Monitor: This extends on the previous topic, along with instructions on setting up a Linux VM for pushing syslogs to Azure Monitor
  7. Using API to Send Syslogs to Azure Monitor: This is an alternative approach to writing logs to syslog. If you’re using Docker to run your R code, then this may be a better solution.
  8. Additional Resources

About the Author

Daren Eiri is Director of Data Science at National Programs, a Brown and Brown company (NYSE: BRO). Please visit my LinkedIn page to connect. I live in San Diego, California with my wife, daughter, dog, and cat.

In my spare time I volunteer with the San Diego County Search and Rescue team. We respond to lost and stranded people in the county — and sometimes outside the county – in urban and wildnerness environments.