How to write into rails log from a job?

Viewed 964

I am facing an issue concerning logs. I built a rails app using ActiveJob with Sidekiq.

I want to write an entry into rails logs from a background job.

Usually, when I want to write an entry, I do something like this (in a controller for instance):

Rails.logger.fatal "BIG ISSUE!!!"

So I wanted to do the same but this time, in a background job:

class MyJob < ApplicationJob
  queue_as :default

  def perform(*args)
    Rails.logger.fatal"FATAL TEST"
  end
end

However nothing is written in the rails logs. Can you explain me why? And how to make this work?

1 Answers
Related