@TODO
Add this line to your application's Gemfile:
gem 'docker-fluent-logger'
And then execute:
$ bundle
Or install it yourself as:
$ gem install docker-fluent-logger
Execute following command in root directory of application.
$ bundle exec docker-fluent-logger install
create config/initializers/lograge.rb
Add following code to app/controllers/application_controller.rb
.
class ApplicationController < ActionController::Base
include DockerFluentLogger::Payload
rescue_from Exception, with: :render_500 if Rails.env.production?
def render_500(e = nil)
append_payload_error(e) if e.present?
end
end
Add following code to config/environments/***.rb
.
if ENV['RAILS_LOG_TO_STDOUT'].present?
config.logger = DockerFluentLogger.create
end
When using ECS Deployer, Add RAILS_LOG_TO_STDOUT
variable to config/deploy/***.yml
.
environment:
- name: RAILS_LOG_TO_STDOUT
value: enabled
MIT