Provide a way to perform additional work in `Logging{Client,Service}`
See original GitHub issueFor example, a user may have some MDC property he or she wants to be logged. To make the current MDC property is transferred to the moment where Logging{Client,Service} logs something, a user has to:
- Store the current thread’s MDC property somewhere, e.g. local variable.
- When
Logging{Client,Service}logs something, load the property from (1) and set it to an MDC property. - After logging is done, the MDC property set in (2) has to be cleared or reverted to the old value.
To make this possible, we need to allow a user specify some custom logic which is executed when:
Logging{Client.execute,Service.serve}()is called, for the step 1.- Before and after logging, for the step 2 and 3.
I’m not really sure if you need to allow running an arbitrary logic, though. It may be just enough to let a user specify a list of MDC keys, so they are stored and loaded automatically. Thoughts?
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Logging client libraries | Google Cloud
Logs consist of individual log entries in structured format, with fields like resource , sourceLocation , labels , and trace that give additional...
Read more >How to Successfully Implement & the Benefits of Customer ...
How to Successfully Implement Customer Logging · Develop a process for providing superior service to Web submissions. · Market your new service to...
Read more >Logging - Ads API - Google Developers
Logging and monitoring work in tandem to help you understand and optimize application performance, as well as to diagnose errors and system-related issues....
Read more >Logging and diagnostics in ASP.NET Core SignalR
To get logs from the .NET client, you can use the ConfigureLogging method on HubConnectionBuilder . This works the same way as the ......
Read more >Logging Overview - Oracle Help Center
Logging provides access to logs from Oracle Cloud Infrastructure resources. These logs include critical diagnostic information that describes how resources ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I tried this but I wasn’t sure I’m going into the right direction because:
ctx.push(), especially for the server side (but not limited to the server side - imagine you write a client-side decorator). He or she might also want to update the captured MDC property:Therefore, I came back to the idea at https://github.com/line/armeria/issues/2634#issuecomment-625637235
The initial feedback from @anuraaga was that it’s not a good idea to add another API similar to the current attribute API. Then how about not providing such API in
RequestContextbut in a separate utility class? e.g.This is better than the previous idea because:
RequestContextAPI. Just one utility class.Thanks everyone for valuable feed back ❤️