-
Notifications
You must be signed in to change notification settings - Fork 27
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
Attempting to wrap a Logging::Logger in a ActiveSupport::TaggedLogging raises an error #27
Comments
+1 |
This is also a problem with Webpacker:
Also see #20. |
As a workaround: add the following to
Works with Rails 4.2, I can now run |
Hey all, When fixing the gem in order to Would you have any idea regarding this issue? Many thanks in advance!! Thomas You can find the error below
This raises due to this: https://github.com/rails/rails/blob/b9ca94caea2ca6a6cc09abaffaad67b447134079/activejob/lib/active_job/logging.rb#L53 |
@rauhryan Thanks for the workaround - it fixed the immediate issue. However, I'm now experiencing NB @TwP: This library is recommended for Rails users by Datadog in order to log to a file and let them tail it, so as long as Datadog is popular and this bug exists, there will be frustrations, although I'm sure this could be a Rails problem and not necessarily a |
thanks @katiekeel Try adding this additional stuff I ran into
It will get you going, it's possible you could try managing the tags array, but I decided to just return an empty array |
Hello @katiekeel , on rails 5, I ended up 🐵 patching both
You can obviously set this in two separate files. |
Thanks @rauhryan and @tdeschamps - @rauhryan's solution worked perfectly. 👍 |
After intorducing both gems, we get the following error when rebooting the server: undefined method `formatter=' for #<Logging::Logger:0x00007f82521ae650> (NoMethodError) This patching is suggested by: TwP/logging-rails#27
Hi,
ActiveSupport::TaggedLogging
is supposed to be able to wrap "any standard Logger object". However, when wrapping an instance ofLogging::Logger
, this does not work:This is because
ActiveSupport::TaggedLogging
tries to set a formatter in case it doesn't exist.Since code that tries to wrap the
Rails.logger
object in aActiveSupport::TaggedLogging
instance is becoming more and more common in the rails ecosystem (cf. here in webpacker), this can be deter many users from using this otherwise good framework.There is a
formatter
method already defined inLogging
so maybe it could be possible to mapformatter=
to the MDC feature of Logging?Also, not sure if this should be part of the logging or the logging-rails repo, it has to do with rails but the
RailsCompat
module is in the logging repo..The text was updated successfully, but these errors were encountered: