tablexi / tablexi-logger

[DEPRECATED] A standardized logging interface for Table XI applications
MIT License
1 stars 0 forks source link

Double Lograge entries #6

Open basicsandwich opened 8 years ago

basicsandwich commented 8 years ago

For projects with Lograge enabled, JSON log entries are logged twice.

Log Entry

{"method":"GET","path":"/why-chicago","format":"html","controller":"why_chicago","action":"index","status":200,"duration":1177.9,"view":1165.24,"db":9.8,"@timestamp":"2015-11-12T21:11:17.291Z","@version":"1","message":"[200] GET /why-chicago (why_chicago#index)"}
{"method":"GET","path":"/why-chicago","format":"html","controller":"why_chicago","action":"index","status":200,"duration":1178.76,"view":1165.24,"db":9.8,"@timestamp":"2015-11-12T21:11:17.292Z","@version":"1","message":"[200] GET /why-chicago (why_chicago#index)"}

Lograge Configuration

MyApp::Application.configure do
  config.lograge.enabled = true
  config.lograge.formatter = Lograge::Formatters::Logstash.new

  # Add params to the log
  config.lograge.custom_options = lambda do |event|
    { params: event.payload[:params].except("controller", "action") }
  end

  config.lograge.keep_original_rails_log = true
  config.lograge.logger = ActiveSupport::Logger.new "#{Rails.root}/log/#{Rails.env}.log.json"
end

For what it's worth, I also tested with config.lograge.enabled = true as the only Lograge configuration option as well, and I see the same behavior, just logged to the default Rails log of course.

stephen-puiszis commented 8 years ago

I'm also having double entries on stage as well. After seeing this and testing locally, log duplication stopped after removing tablexi-logger from the Gemfile.