-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to output all keys and values in thread context #708
Conversation
The keys in a thread context can differ for different code paths. It would be good if one could log whatever keys and values exist in the thread context without specifying all possible keys in the logging configuration. This change modifies the "context" placeholder so that it can be used without specifying a key. When no key is specified, all keys and their values are sent to the output.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2.7 #708 +/- ##
============================================
- Coverage 94.27% 94.25% -0.02%
- Complexity 2833 2838 +5
============================================
Files 149 149
Lines 5484 5502 +18
Branches 725 727 +2
============================================
+ Hits 5170 5186 +16
Misses 176 176
- Partials 138 140 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your commit! It looks great so far :) I have just three minor improvement suggestions.
tinylog-impl/src/test/java/org/tinylog/pattern/FormatPatternParserTest.java
Outdated
Show resolved
Hide resolved
tinylog-impl/src/main/java/org/tinylog/pattern/ThreadContextToken.java
Outdated
Show resolved
Hide resolved
A previous commit introduced an ehancement allowing the user to output all thread context keys and values by using the "context" placeholder without specifying a key. This commit addresses feedback from a review of that code: notably, the output is now sorted alphabetically by key, and unit test code coverage is improved.
@pmwmedia Thanks for your feedback! I've made some new changes. Let me know if I got it right. |
Thank you very much! I will publish it together with tinylog 2.8. |
Great! Do you need me to make an equivalent change to the v3.0 branch? |
I would be very happy about a PR for the v3.0 branch :) |
Description
The keys in a thread context can differ for different code paths. It would be good if one could log whatever keys and values exist in the thread context without specifying all possible keys in the logging configuration.
This change modifies the
context
placeholder so that it can be used without specifying a key. When no key is specified, all keys and their values are sent to the output.Linked website pull request, if the documention of https://tinylog.org/v2/ has to be updated:
tinylog-org/website#188
Definition of Done
mvn verify
)Agreements