5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ActiveJobのログをマスクする

Posted at

ActiveJobのパラメータにマスクすべき情報を設定している場合に使う。

HogeJob のログを消したい場合は

config/initializers/active_job_logger_patch.rb
ActiveSupport.on_load :active_job do
  class ActiveJob::Logging::LogSubscriber
    private def args_info(job)
      if job.arguments.any?
        if job.class == HogeJob
          " #{job.class} arguments is masking"
        else
          ' with arguments: ' +
            job.arguments.map { |arg| arg.try(:to_global_id).try(:to_s) || arg.inspect }.join(', ')
        end
      else
        ''
      end
    end
  end
end

これでOK。

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?