From 24e7562a622d563e0915f7a447a17872213ed7a3 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 23 Sep 2013 09:07:48 +0200 Subject: hotfix: add syslog logger gem in production --- common_dependencies.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common_dependencies.rb b/common_dependencies.rb index c795d66..9632893 100644 --- a/common_dependencies.rb +++ b/common_dependencies.rb @@ -19,3 +19,6 @@ group :test, :development do gem 'quiet_assets' end +group :production do + gem 'SyslogLogger' +end -- cgit v1.2.3 From 07a1dc526af800b68e9c1a5ccf8e0179fc417ced Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 23 Sep 2013 11:25:55 +0200 Subject: hotfix: syslog now uses a different name also make sure the gem > 2.0.0 so it actually IS called Syslog::Logger. --- common_dependencies.rb | 2 +- config/environments/production.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common_dependencies.rb b/common_dependencies.rb index 9632893..6a43e26 100644 --- a/common_dependencies.rb +++ b/common_dependencies.rb @@ -20,5 +20,5 @@ group :test, :development do end group :production do - gem 'SyslogLogger' + gem 'SyslogLogger', '~> 2.0' end diff --git a/config/environments/production.rb b/config/environments/production.rb index 73e98e5..e34a4c9 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -35,9 +35,10 @@ LeapWeb::Application.configure do # Use syslog if no file has been specified if APP_CONFIG[:logfile].blank? + require 'syslog/logger' # Prepend all log lines with the following tags config.log_tags = [ :leap, :webapp ] - config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new) end # Use a different cache store in production -- cgit v1.2.3 From 68e056061648be393dc785419fc066ec3d719e58 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 23 Sep 2013 19:56:03 +0200 Subject: Revert "default to syslog in production - #3886" This reverts commit 073dc636ffa2da07ee7a719c6166a3ca1b593fb3. Conflicts: config/environments/production.rb --- config/application.rb | 2 +- config/environments/production.rb | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config/application.rb b/config/application.rb index 8587ffc..e8bb2f4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -54,7 +54,7 @@ module LeapWeb # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] - if APP_CONFIG[:logfile].present? + if APP_CONFIG[:logfile] config.logger = Logger.new(APP_CONFIG[:logfile]) end diff --git a/config/environments/production.rb b/config/environments/production.rb index e34a4c9..32b4558 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -33,13 +33,11 @@ LeapWeb::Application.configure do # See everything in the log (default is :info) # config.log_level = :debug - # Use syslog if no file has been specified - if APP_CONFIG[:logfile].blank? - require 'syslog/logger' - # Prepend all log lines with the following tags - config.log_tags = [ :leap, :webapp ] - config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new) - end + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production # config.cache_store = :mem_cache_store -- cgit v1.2.3 From 9fa07d19ab9ad8dea15b1fcb8b2c739d79a36d8f Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 24 Sep 2013 10:31:04 +0200 Subject: fix syslogger, log_tags are called on request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit log_tags was causing errors that could not be logged or caught. We don't need them yet anyway. config.log_tags accepts a list of methods that respond to request object. This makes it easy to tag log lines with debug information like subdomain and request id — both very helpful in debugging multi-user production applications. http://guides.rubyonrails.org/configuring.html --- config/application.rb | 2 +- config/environments/production.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/application.rb b/config/application.rb index e8bb2f4..8587ffc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -54,7 +54,7 @@ module LeapWeb # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] - if APP_CONFIG[:logfile] + if APP_CONFIG[:logfile].present? config.logger = Logger.new(APP_CONFIG[:logfile]) end diff --git a/config/environments/production.rb b/config/environments/production.rb index 32b4558..7acca75 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -33,11 +33,11 @@ LeapWeb::Application.configure do # See everything in the log (default is :info) # config.log_level = :debug - # Prepend all log lines with the following tags - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # Use syslog if no file has been specified + if APP_CONFIG[:logfile].blank? + require 'syslog/logger' + config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('webapp')) + end # Use a different cache store in production # config.cache_store = :mem_cache_store -- cgit v1.2.3