Skip to content

h-nago/docker-fluent-logger

 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 97.5%
  • Shell 2.5%