Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.08 KB

README.md

File metadata and controls

65 lines (45 loc) · 1.08 KB

DockerFluentLogger

@TODO

Installation

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

Setup

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

License

MIT