|
54 | 54 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
55 | 55 | config.force_ssl = ENV.key?("FORCE_SSL")
|
56 | 56 |
|
57 |
| - # Log to STDOUT by default |
58 |
| - config.logger = ActiveSupport::Logger.new($stdout) |
59 |
| - .tap { |logger| logger.formatter = Logger::Formatter.new } |
60 |
| - .then { |logger| ActiveSupport::TaggedLogging.new(logger) } |
61 |
| - |
62 |
| - # config.logger = Logger.new($stdout) if Settings.log_to_stdout |
63 |
| - config.log_level = Settings.log_level ? Settings.log_level.downcase.to_sym : "error" |
64 |
| - |
65 |
| - # Prepend all log lines with the following tags. |
66 |
| - config.log_tags = [:request_id] |
| 57 | + # Logging |
| 58 | + config.logger = if ENV["RAILS_LOG_TO_STDOUT"].present? || Settings.log_to_stdout |
| 59 | + # Log to STDOUT by default |
| 60 | + ActiveSupport::Logger.new($stdout) |
| 61 | + .tap { |logger| logger.formatter = Logger::Formatter.new } |
| 62 | + .then { |logger| ActiveSupport::TaggedLogging.new(logger) } |
| 63 | + else |
| 64 | + ActiveSupport::TaggedLogging.new(Logger.new("log/production.log")) |
| 65 | + .tap { |logger| logger.formatter = ::Logger::Formatter.new } |
| 66 | + .then { |logger| ActiveSupport::TaggedLogging.new(logger) } |
| 67 | + end |
67 | 68 |
|
68 | 69 | # Info include generic and useful information about system operation, but avoids logging too much
|
69 | 70 | # information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
70 | 71 | # want to log everything, set the level to "debug".
|
71 |
| - config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") |
| 72 | + # Obey settings.yml |
| 73 | + config.log_level = Settings.log_level |
| 74 | + |
| 75 | + # Prepend all log lines with the following tags. |
| 76 | + config.log_tags = [:request_id] |
72 | 77 |
|
73 | 78 | # Use a different cache store in production.
|
74 | 79 | # config.cache_store = :mem_cache_store
|
|
77 | 82 | # config.active_job.queue_adapter = :resque
|
78 | 83 | # config.active_job.queue_name_prefix = "password_pusher_production"
|
79 | 84 |
|
80 |
| - config.action_mailer.perform_caching = false |
| 85 | + config.action_mailer.perform_caching = true |
81 | 86 |
|
82 | 87 | # Ignore bad email addresses and do not raise email delivery errors.
|
83 | 88 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
135 | 140 | end
|
136 | 141 | end
|
137 | 142 |
|
138 |
| - if ENV["RAILS_LOG_TO_STDOUT"].present? || Settings.log_to_stdout |
139 |
| - logger = ActiveSupport::Logger.new($stdout) |
140 |
| - logger.formatter = config.log_formatter |
141 |
| - config.logger = ActiveSupport::TaggedLogging.new(logger) |
142 |
| - end |
143 |
| - |
144 | 143 | # If a user sets the allowed_hosts setting, we need to add the domain(s) to the list of allowed hosts
|
145 | 144 | if Settings.allowed_hosts.present?
|
146 | 145 | if Settings.allowed_hosts.is_a?(Array)
|
|
0 commit comments