Reputation: 1244
The default rails production setup seems to be overwriting stackdriver logger configuration.
The stackdriver gem documentation entails that nothing else is need in order to get it to work with ruby and rails but by default a rails app has this configuration on the production.rb
. I'm setting RAILS_LOG_TO_STDOUT=true
.
config.log_formatter = ::Logger::Formatter.new
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
What's the ideal setup? Logs are not displayed if this setup is removed.
Upvotes: 3
Views: 600
Reputation: 361
For the use of Ruby with Stackdriver logging see this documentation on Stackdriver Logging Client Libraries and Setting Up Cloud Logging for Ruby.
Here's also a reference documentation for the APIs Module: Google::Cloud::Logging
Upvotes: -1