What I want to have: all logs in JSON format, with additional tags and per-request tags (similar to java's MDC)
How to make it:
- Use
lograge
withlogstash-event
to change default request logs - Make custom log formatter
- Override
ActiveSupport::TaggedLogging
format - Add own error handlers with
config.exceptions_app = self.routes
- Override default logger at the right time
Use environment variables JSON_LOGGER = true/false
and RAILS_LOG_LEVEL = info / debug / etc