I want to find a way to log ActiveJob logs to a different log other than the production.log
I am on a rails 4.2.5 project. The project used a lot of ActiveJob and DelayedJob. they write into same log, making the log very messy and hard to debug. I want to write the job log to a different file, so I did this in initializers/delayed_job.rb:
delayed_job_logger = Logger.new(File.join(Rails.root, 'log', "delayed_job_# {Rails.env}.log"), 10, 100 * 1024 * 1024)
Delayed::Worker.logger = delayed_job_logger
ActiveJob::Base.logger = delayed_job_logger
After the configuration, the delayed job logs is doing well. it did write to delayed_job_production.log
I, [2019-07-02T12:33:36.664242 #14335] INFO -- : 2019-07-02T12:33:36-0500: [Worker(delayed_job.6 host:pioneer3-app-production pid:14335)] Job ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper (id=60672406) (queue=TfrToP2InTimeJob) COMPLETED after 0.0098
but the ActiveJob log is still mixing in the production.log
I, [2019-07-02T12:33:42.091068 #13730] INFO -- : [ActiveJob] [PipelineRollMonthJob] [93fc7600-2ba9-48eb-a6bd-729d3e830114] Performed PipelineRollMonthJob from DelayedJob(PipelineRollMonthJob) in 5.53ms
how can I fix the activejob log?
Aucun commentaire:
Enregistrer un commentaire