简体   繁体   中英

Logging in a Rails mailer receive method

In the #receive method of a Rails mailer, I wish to perform some logging.

My method looks like this:

def receive(email)
  logger.warn "Now receiving e-mail..."
  # do stuff
end

Everything works just fine, I can receive e-mails and do stuff with them. However, I do not see any logged output, neither in logs/production.log nor in /var/log/syslog (this is on a Linux machine).

When I interact with the app via HTTP requests, logging works just fine.

How can I log from the #receive method of a Rails mailer?

Set logging levels in Ruby on Rails

Have you set your logger level to include warnings? If you have and you're still having issues try:

config.logger.level = Logger::WARN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM