-
Notifications
You must be signed in to change notification settings - Fork 104
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 tagged logging support #35
Conversation
Implement tagged logging similar to ActiveSupport::TaggedLogging.
Don't use the default_options to pass the tags into the logger. This causes the tags field to be sent over to graylog as an array. Instead pass the tag names into an attribute called log_tags that matches with the Rails standard of config.log_tags.
Is there a reason why this was never pulled? It would be very useful to have this feature. |
@bernd pinging you because you seem to be the most active committer right now. This feature is important to me because it's the only way to tag error logs with a request UUID that would allow us to trace the error through our entire stack. What's holding it back from being merged? I'm volunteering to contribute whatever might be required :) |
Thank you for the contribution, @markglenn! It seems to me that it would be even better to have this in a separate |
end | ||
|
||
def current_tags | ||
Thread.current[:gelf_tagged_logging_tags] ||= [] |
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.
In my experience it's slightly safer to use thread_variable_set
/ thread_variable_get
.
@milgner I would close this PR as this is really old - please comment on that within a week or i'll close it. |
@jalogisch after additional thought - I wasn't sure about the naming at first - I think this should be merged after all. I made an additional commit to replace |
thanks for the comment @milgner - yes the CLA is required. Without we are not able to merge that. |
@markglenn if you sign the CLA and update the PR we would review and merge. |
@jalogisch I signed the CLA 3 years ago when I first created this pull request (and another one that did get pulled in). |
I also believe this can't be merged in as is without a decent amount of rework due to changes in the code layout. I vote to close this pull request and have someone take a stab at porting it to the newer code layout. If I need to re-sign the CLA to allow someone to do that, I'm happy to sign. |
Solved merge conflicts in Meat-Chopper@1f799ca |
Closing this in lieu of PR #81 Good luck @Meat-Chopper in getting yours merged in. I'd like this in master so we can get off our forked copy. Honestly, their management of the CLA is frustrating. |
Wow, what a mess. Seriously, Graylog people. I love your product but if you want help from the OS community you have to take this a bit more seriously. Next time no one is going to bother. |
This adds support for tagged logging that is compatible with ActiveSupport::TaggedLogging.
I'm open for discussion on whether the initialization for the tagged logging is the right way to go. In a Rails application config file, I would use it like this:
From the other pull requests submitted prior to this, they added the tag names in the default_options hash, but this causes that array to be pushed onto Graylog. We could remove that key from default_options, but that could be an issue if someone would like to use that hash key we choose for their own use. It also doesn't make sense to me to put configuration in the default options hash, since this hash is the default hash for every message to Graylog.
Instead I'm opting to create an attribute called log_tags on the LoggerCompatibility module which mimics the Rails method.
If this looks ok, I can add to the README.rdoc file on usage.
Thanks to @mitnal since this is heavily inspired by pull request #8