Skip to content
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

custom fields don't show up in log entries #93

Open
ctaintor opened this issue Dec 5, 2015 · 0 comments
Open

custom fields don't show up in log entries #93

ctaintor opened this issue Dec 5, 2015 · 0 comments

Comments

@ctaintor
Copy link

ctaintor commented Dec 5, 2015

There's a bug in 0.8 where, if you set custom_fields, they will be cleared before they are really used. The problem is that all three log subscribers (ActiveRecord, ActionView, ActionController) have this line:

LogStasher.custom_fields.clear

practically, this means that you will only see custom fields on your ActionController log entries if you have no view rendering or AR calls, since those calls will cause their associated log subscriber to clear the custom_fields array. This isn't very useful.

A temporary workaround is to just disable the new log subscribers like so in your config/logstasher.rb

  ::ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
    case subscriber.class.name
      when 'LogStasher::ActionView::LogSubscriber'
        LogStasher.unsubscribe(:action_view, subscriber)
      when 'LogStasher::ActiveRecord::LogSubscriber'
        LogStasher.unsubscribe(:active_record, subscriber)
    end
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant