This PR addresses several issues related to logging: - Enabling Lograge broke certain non-API URLs, such as password reset. This occurred due to the user ID tagging we had in Lograge, which has now been limited to API pages only. - Disabled the start and done logs in Sidekiq. - Investigated why Sidekiq logs weren’t being output as JSON. This is due to the use of ActiveJob instead of Sidekiq for the job base classes. **Potential Options for Converting ActiveJob Logs to JSON:** - https://glozer.rocks/ojb - https://learnedreverie.medium.com/activejob-logs-as-json-6912403d8c81 - https://github.com/roidrage/lograge/pull/226
21 lines
679 B
Ruby
21 lines
679 B
Ruby
require Rails.root.join('lib/redis/config')
|
|
|
|
schedule_file = 'config/schedule.yml'
|
|
|
|
Sidekiq.configure_client do |config|
|
|
config.redis = Redis::Config.app
|
|
end
|
|
|
|
Sidekiq.configure_server do |config|
|
|
config.logger.formatter = Sidekiq::Logger::Formatters::JSON.new
|
|
config.redis = Redis::Config.app
|
|
# skip the default start stop logging
|
|
config[:skip_default_job_logging] = true
|
|
config.logger.level = Logger.const_get(ENV.fetch('LOG_LEVEL', 'info').upcase.to_s)
|
|
end
|
|
|
|
# https://github.com/ondrejbartas/sidekiq-cron
|
|
Rails.application.reloader.to_prepare do
|
|
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) if File.exist?(schedule_file) && Sidekiq.server?
|
|
end
|