Kristoph Matthews
Kristoph Matthews

Reputation: 349

How do I remove mail html content from Rails' logs?

After an email has been delivered, the entire content of the email is visible in the logs in production, which is really messy. Can I remove the email content from the logs just in production?

Upvotes: 11

Views: 2209

Answers (2)

wdspkr
wdspkr

Reputation: 636

You may also consider setting the log level of your whole application in production to something less verbose than :debug. That way you will still log info about the mails being sent, but without the content:

# config/environments/production.rb

Rails.application.configure do
  ...
  config.log_level = :info
  ...
end

Upvotes: 6

Ben
Ben

Reputation: 5182

ActionMailer::Base.logger = nil

or in your config/environments/{development,test,production}.rb, add :

Rails.application.configure do
  ...
  config.action_mailer.logger = nil
  ...
end

Upvotes: 9

Related Questions