DEV: Use `Rails.logger` instead of logster for rails_failover callbacks

`Discourse.warn_exception` logs to logger by default but it means we
lose all the backtrace when the logs are written to the log file.
This commit is contained in:
Guo Xiang Tan 2020-06-11 17:24:32 +08:00
parent b66f2187f1
commit dc4071dfef
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
1 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ if ENV["ACTIVE_RECORD_RAILS_FAILOVER"]
Sidekiq.pause!("pg_failover") if !Sidekiq.paused?
end
rescue => e
Discourse.warn_exception(e, message: "Failed to run failover callback")
Rails.logger.warn "#{e.class} #{e.message}: #{e.backtrace.join("\n")}"
false
end
@ -45,7 +45,7 @@ if ENV["ACTIVE_RECORD_RAILS_FAILOVER"]
ActiveRecord::Base.connection_handlers[ActiveRecord::Base.writing_role]
end
rescue => e
Discourse.warn_exception(e, message: "Failed to run fallback callback")
Rails.logger.warn "#{e.class} #{e.message}: #{e.backtrace.join("\n")}"
false
end
@ -76,7 +76,7 @@ if ENV["ACTIVE_RECORD_RAILS_FAILOVER"]
Discourse::PG_FORCE_READONLY_MODE_KEY
)
rescue => e
Discourse.warn_exception(e, message: "Failed to force AR reading role")
Rails.logger.warn "#{e.class} #{e.message}: #{e.backtrace.join("\n")}"
false
end
end