diff --git a/Gemfile b/Gemfile index 0575fe3..2f7eb30 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem 'aws-sdk' # For pushing out updates after processing an event. gem 'pusher' +gem 'lograge' group :development, :test do gem 'byebug' diff --git a/circle.yml b/circle.yml index 609f61a..433b0da 100644 --- a/circle.yml +++ b/circle.yml @@ -32,7 +32,7 @@ deployment: - docker push soutech/champaign-ak-processor - ./deploy.sh $CIRCLE_SHA1 'champaign' 'ak-worker-production' 'logs3.papertrailapp.com:44107' staging: - branch: development + branch: lograge-logging commands: - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - docker push soutech/champaign-ak-processor diff --git a/config/environments/production.rb b/config/environments/production.rb index 5c1b32e..f68785b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -44,9 +44,19 @@ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. - config.log_level = :debug + config.log_level = :info + config.lograge.enabled = true + + config.lograge.custom_options = lambda do |event| + params = event.payload[:params].reject do |k| + ['controller', 'action'].include? k + end + log_hash = {"params"=> params, "time"=>event.time} + if event.payload[:exception].present? + log_hash["exception"] = event.payload[:exception] + end + log_hash + end # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ]