delayed_job icon indicating copy to clipboard operation
delayed_job copied to clipboard

Is it possible to write delayed_jobs.log to Logs in Openshift pod?

Open satriajanaka09 opened this issue 4 years ago • 0 comments

The application that me and my team working on use Ruby on Rails hosted in Openshift pod. We use delayed_job to handle background process, and for delayed_job logging, the application write the log into log/delayed_job.log file. However, if a new pod for the application is created, the pod will create a new file. Also, the company is using Kibana to save every log from Openshift pod.

What we tried so far is put this code in delayed_job_config.rb

Delayed::Worker.logger = Logger.new(STDERR)

To write the log for another process beside delayed job, in order to write the log in Openshift pod log, we use this following code, e.g: Rails.logger.info "Result: #{ldap.get_operation_result.code}"

However, the delayed_job log is not still appear in Logs tab of the pod (in order for the log to appear in Kibana)

The goal is to write the log in Logs tab of the Openshift pod.

Here's the screenshoot of Logs in Openshift pod :

image

Ruby version : 2.7.1p83 Rails version : 6.0.4.1

UPDATE :

We tried to put Delayed::Worker.logger = Rails.logger in delayed_job_config.rb but still did not work

satriajanaka09 avatar Mar 17 '22 09:03 satriajanaka09