diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index 8d59a6fcf3..82509f5ef5 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -54,7 +54,7 @@ Rails.application.configure do config.log_level = :debug # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :request_id ] + config.log_tags = [ :request_id ] # Use a different logger for distributed setups. # require 'syslog/logger' diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index af3a391cc4..7bcfc86d03 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -79,6 +79,24 @@ module ApplicationTests end end + test "By default logs tags are not set in development" do + restore_default_config + + with_rails_env "development" do + app 'development' + assert Rails.application.config.log_tags.blank? + end + end + + test "By default logs are tagged with :request_id in production" do + restore_default_config + + with_rails_env "production" do + app 'production' + assert_equal [:request_id], Rails.application.config.log_tags + end + end + test "lib dir is on LOAD_PATH during config" do app_file 'lib/my_logger.rb', <<-RUBY require "logger"