Skip to content

App logs suppression is broken #193

Description

@epoberezhny

This method loops through log_subscribers and modifies them simultaneously. So some subscribers can be accidentally skipped

def remove_existing_log_subscriptions
::ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
case subscriber.class.name
when 'ActionView::LogSubscriber'
unsubscribe(:action_view, subscriber)
when 'ActionController::LogSubscriber'
unsubscribe(:action_controller, subscriber)
when 'ActionMailer::LogSubscriber'
unsubscribe(:action_mailer, subscriber)
when 'ActiveRecord::LogSubscriber'
unsubscribe(:active_record, subscriber)
when 'ActiveJob::LogSubscriber' # For Rails 6
unsubscribe(:active_job, subscriber)
when 'ActiveJob::Logging::LogSubscriber' # For Rails 5
unsubscribe(:active_job, subscriber)
end
end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions