目前项目中使用 rails5,使用的是 sidekiq,有个从前端上传 canvas 到后端存储的需求,每次上传 development.log 日志里面就会有个大长串的 canvas base64 的字段,很影响观感,不知道怎么关闭,配置 config/initializers/filter_parameter_logging.rb 不行,配置 config/environments/development.rb 也不行
config/initializers/filter_parameter_logging.rb
Rails.application.config.filter_parameters += [:password,:image]
config/environments/development.rb
config.active_job.logger = Logger.new(nil)
[ActiveJob] [PdfJob] [a7be2eda-d8cf-4d50-bc71-903fe44bf420] Performing PdfJob (Job ID: a7be2eda-d8cf-4d50-bc71-903fe44bf420) from Sidekiq(default) with arguments: {"image"=>"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACUwAAA0oCAYAAABOaEMiAAAAAXNSR0IArs4c6QAAIABJREFUeF7svQeXZNW1JvhdGxEZmVlVVBWuAIGEE0LCG4GE9LTU/UtnpmfWm+63Vr813fOmW14ICSOMDAgEDys8VZUmMiKum7X3PufeE5H37BMVoWyQ0GUVlZUR1x2z7be/HTVN0+ALeNjHor/7fi6LxPvU9EYlau/ndQXU/o/V0YgiIIritUesbmqgAb9T91416JnjOEKaZsp7def0fYnOB+jP8SOKGqSRf6pjeidzKj9b3YCfFfKsSZzztfvmg35XliV/N4oi/kPPYsdJzqFr0e9k/Oyz0r+ras3JACBz2f/O9Dx1M6c38IxphDQZesd7TuO1f4Dh7/6I4ic/RfX888gPL6JMC1yuJtjKxogjWYf0jnVN8yj3ov83oy2kV53D7v33Y+sH38XRXXdgLx0DEyArgCYqvPdOPvoAyXsfYv78y9j71TOo33kLW4Ma8TjGUTQD5nPUF27E4IGHMX7oUcRfuQX11g7iNEMxb1AfznD6.........