Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I filter or remove logging of ActiveJob arguments?

I'm using Rails' ActiveJob, and one of my jobs take a raw email as input. When debugging, this can result in a huge amount of noise in my application log. How can I avoid that?

[ActiveJob] Enqueued EmailParserJob (Job ID: 9678f343-c876-4f9f-9cc7-db440634e178) to DelayedJob(default) with arguments: "NOISE"
like image 678
Jeppe Liisberg Avatar asked Aug 17 '15 08:08

Jeppe Liisberg


People also ask

How do I enqueue a job in rails?

Enqueue jobs The different enqueuing options are the following: wait : With this, the job is enqueued after the mentioned time period. wait_until : With this, the job is enqueued after that the specified time has elapsed. queue : With this, the job is added to the specified queue.

What is Activejob when should we use it?

Active Job is a framework for declaring jobs and making them run on a variety of queueing backends. These jobs can be everything from regularly scheduled clean-ups, to billing charges, to mailings. Anything that can be chopped up into small units of work and run in parallel, really.

What is background jobs in Rails?

Running Background Jobs in Ruby on Rails Containers – DevGraph. A SQL load balancer that enables you to dramatically scale and improve database performance without any code changes to your application or database.


1 Answers

See https://github.com/rails/rails/blob/4-2-stable/activejob/lib/active_job/logging.rb#L10

ActiveJob::Base.logger = Logger.new(nil)
like image 185
Mihai Târnovan Avatar answered Oct 08 '22 20:10

Mihai Târnovan