Skip to content

Commit

Permalink
revert logging. #405
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 31, 2020
1 parent 1ae2b6a commit 6d7fe9b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 24 deletions.
48 changes: 24 additions & 24 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,30 @@ class Application < Rails::Application
# secret_key_base is not used by Rails API, as there are no sessions
config.secret_key_base = "blipblapblup"

config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Logstash.new
config.lograge.logger = ::LogStashLogger.new(
type: :stdout,
)
config.lograge.log_level = ENV["LOG_LEVEL"].to_sym

config.active_job.logger = config.lograge.logger

config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"]
config.lograge.ignore_custom = lambda do |event|
event.payload.inspect.length > 100000
end
config.lograge.base_controller_class = "ActionController::API"

config.lograge.custom_options = lambda do |event|
exceptions = %w(controller action format id)
{
params: event.payload[:params].except(*exceptions),
uid: event.payload[:uid],
}
end
config.logger = config.lograge.logger
config.active_record.logger = nil
# config.lograge.enabled = true
# config.lograge.formatter = Lograge::Formatters::Logstash.new
# config.lograge.logger = ::LogStashLogger.new(
# type: :stdout,
# )
# config.lograge.log_level = ENV["LOG_LEVEL"].to_sym

# config.active_job.logger = config.lograge.logger

# config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"]
# config.lograge.ignore_custom = lambda do |event|
# event.payload.inspect.length > 100000
# end
# config.lograge.base_controller_class = "ActionController::API"

# config.lograge.custom_options = lambda do |event|
# exceptions = %w(controller action format id)
# {
# params: event.payload[:params].except(*exceptions),
# uid: event.payload[:uid],
# }
# end
# config.logger = config.lograge.logger
# config.active_record.logger = nil

# configure caching
config.cache_store = :dalli_store, nil, { :namespace => ENV['APPLICATION'] }
Expand Down
26 changes: 26 additions & 0 deletions config/initializers/_lograge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require "elasticsearch/rails/lograge"

Rails.application.configure do
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Logstash.new
config.lograge.logger = LogStashLogger.new(type: :stdout)
config.lograge.log_level = ENV["LOG_LEVEL"].to_sym

config.active_job.logger = config.lograge.logger

config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"]
config.lograge.ignore_custom = lambda do |event|
event.payload.inspect.length > 100000
end
config.lograge.base_controller_class = "ActionController::API"

config.lograge.custom_options = lambda do |event|
exceptions = %w(controller action format id)
{
params: event.payload[:params].except(*exceptions),
uid: event.payload[:uid],
}
end
end

0 comments on commit 6d7fe9b

Please sign in to comment.