collectiveidea / delayed_job

Database based asynchronous priority queue system -- Extracted from Shopify
http://groups.google.com/group/delayed_job
MIT License
4.81k stars 955 forks source link

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

Open satriajanaka09 opened 2 years ago

satriajanaka09 commented 2 years ago

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