jam-cloud/web/config/initializers/logging_patch.rb

16 lines
605 B
Ruby

# Patch Logging::Logger to satisfy Rails 5+ Server#log_to_stdout expectations.
# Rails tries to broadcast logs to STDOUT when starting 'rails s'.
# Since logging-rails already handles STDOUT logging configuration via config.log_to,
# we can just tell Rails that we've handled the broadcast request.
if defined?(Logging::Logger)
class Logging::Logger
def broadcast_to(*args)
# Return true to tell Rails that broadcasting is handled/supported,
# effectively preventing Rails from trying to wrap/extend the logger again
# or duplicate the stdout output.
true
end
end
end