mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Route Sidekiq logs to Rails logger (#15817)
Most of our logging goes through Rails.logger, and therefore appears in Logster at `/logs` on a site. The Sidekiq logger was bypassing this and writing directly to STDERR. Unfortunately it's not possible to do `Sidekiq.logger = Rails.logger` because `Sidekiq#logger=` applies a number of patches to the logger instance, causing our whole logging system to break. Instead, this commit adds a dedicated Logger instance with no output, which is then patched to forward all messages directly to `Rails.logger`
This commit is contained in:
@@ -27,11 +27,6 @@ class Demon::Sidekiq < ::Demon::Base
|
||||
|
||||
puts "Loading Sidekiq in process id #{Process.pid}"
|
||||
require 'sidekiq/cli'
|
||||
# CLI will close the logger, if we have one set we can be in big
|
||||
# trouble, if STDOUT is closed in our process all sort of weird
|
||||
# will ensue, resetting the logger ensures it will reinit correctly
|
||||
# parent process is in charge of the file anyway.
|
||||
Sidekiq.logger = Sidekiq::Logger.new(STDERR, level: Logger::WARN)
|
||||
cli = Sidekiq::CLI.instance
|
||||
|
||||
# Unicorn uses USR1 to indicate that log files have been rotated
|
||||
|
||||
Reference in New Issue
Block a user