---
title: "Discussion on \"Small Gem:  Use MDC to add a prefix to every log statement\" | Hashnode"
description: "Discussion on \"Small Gem:  Use MDC to add a prefix to every log statement\". This one was a lifesaver.  I was working on code that processes messages, and needed to add the message id to every log statement.  While this sounds straightforward, in reality it wasn't.  Here's a very simplified version of the code that illustrate..."
url: "https://hashnode.com/posts/small-gem-use-mdc-to-add-a-prefix-to-every-log-statement/61560961e896275f335dfbda"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Small Gem: Use MDC to add a prefix to every log statement](https://codegroovy.com/small-gem-use-mdc-to-add-a-prefix-to-every-log-statement?utm_source=hashnode&utm_medium=feed)

This one was a lifesaver. I was working on code that processes messages, and needed to add the message id to every log statement. While this sounds straightforward, in reality it wasn't. Here's a very simplified version of the code that illustrate...

Sep 30, 2021 · 2 min read · codegroovy.com  
Read the article

-   [#programming-languages](https://hashnode.com/tag/programming-languages)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)

## Written by

[Miriam](https://hashnode.com/@mimi)

@mimi

  
[View profile](https://hashnode.com/@mimi)

software engineer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
