Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4622

Rails.logger not working in ApplicationJob.before_perform

$
0
0

I'm using ActiveJob to manage my jobs, and I have the following ApplicationJob:

class ApplicationJob < ActiveJob::Base  # [...]  before_perform do |job|    Rails.logger.info 'before_perform callback triggered' # This doesn't log  end  # [...]end

Additionally, I have another job that inherits from ApplicationJob:

class MyJob < ApplicationJob  def perform    # do something    Rails.logger.info 'perform method called' # This logs correctly  endend

I've configured my logger to write to a file, and while the logs inside the perform method are written to the file as expected, the logs from the before_perform callback don't appear at all.

For context, I'm invoking the jobs using both perform_now and perform_later methods, but neither seems to trigger the before_perform log.

Thanks in advance!


Viewing all articles
Browse latest Browse all 4622


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>