Question: Rails change logger level for a specific job

Question

Rails change logger level for a specific job

Answers 0
Added at 2016-11-10 15:11
Tags
Question

I need to debug a job on my production data. I have enhanced my ActiveJobs to support a dry_run mode, and I'd like to temporarily change the logger level to :debugfor this specific job execution

I am calling in my console

MyJob.perform_later(dry_run: true, log_level: 'debug')

I am instanciating my logger as a class variable during job initialization

@logger = Rails.logger and return if logger.blank?

How can I either switch the Rails logger (just for this Job) or maybe copy the current Rails logger and just change the log level ?

Answers to

Rails change logger level for a specific job

Source Show
◀ Wstecz