Useful Logs

Part 1 of 5 in the series Meaningful Logs From printing "hello world" to debugging your first program, nearly everyone starts their coding journey with a log statement. In my experience, developers have an intuitive understanding of how powerful logs are as an introspection tool. What’s not as obvious is that the simple form of logging that works so well during development loses most its utility in productionized code. In production, logs are emitted from many processes over a large time period. Without a well thought out logging strategy you’ll find it nearly impossible to rebuild the sequential logflow that printed out so naturally on a single machine. ...

June 20, 2025 · 6 min · Alex Kaplan

Structured Log Primer

Part 2 of 5 in the series Meaningful Logs Context Structured logging is the practice of attaching key value pairs to event logs for the purpose of simplifying log search and consumption. For more motivating details see the first article in the series Useful Logs. Anatomy Structured logs can be thought of as dictionaries with a dedicated field holding the log message and the remaining fields adding context. That’s really all there is to it! ...

June 20, 2025 · 7 min · Alex Kaplan

Structured Logging in Python

Part 3 of 5 in the series Meaningful Logs Now that we’re fully motivated to structure all of our logs we can dive into the specifics of structured logging through examples. The remainder of this series will focus on structured logging in Python. We’ll use packages specific to Python and write several custom Python utilities. In many ways this series will serve as a comprehensive guide for structured logging specifically in Python. That being said, the ideas and practices covered are generic. The following articles will still be useful to anyone hoping to get a better grasp on structured logging. ...

June 20, 2025 · 13 min · Alex Kaplan

Logging Errors

Part 4 of 5 in the series Meaningful Logs Error logging is truly hard to get right. Even with the right tools and best practices it still takes conscious effort to construct meaningful errors. In this post, I’ll dig into why error logging is so difficult and what it takes to do it well. In the next article, I’ll walk through how to log errors in Python using a custom exception library. ...

June 20, 2025 · 9 min · Alex Kaplan

Logging Errors in Python

Part 5 of 5 in the series Meaningful Logs In the previous article, we explored the many challenges of logging errors—how to capture them effectively, group them meaningfully, and support fast debugging. This article grounds that discussion in practical examples and utilities that can be used as the foundation for robust error logging in Python. We’ll cover: A pattern for structured logging in Python that satisfies all three requirements. Direct integration with structlog and Sentry. Logging examples Custom Python Exceptions The previous article outlined three core expectations for any robust error logging solution: ...

June 20, 2025 · 8 min · Alex Kaplan