开发者

How to disable console output on Rails 3 development server?

How can I disable the console output on a Rails 3 application? More specifically, I want to disable at least the Mailer output, that outputs the entire email content, including the pictures, making 开发者_C百科the action processing much slower (it takes almost 10sec to send an email).

ps: I think the slowdown is because of the output, if it can be from another source, such as slow smtp server (it's gmail atm, so no.) or something else like that please let me know.


By this you mean you want to hide the output shown in the console run you run rails s (or script/server in rails 2)?

Are you on Linux or OSX?

If so, then just do the following

$ rails server 1> /dev/null

this sends all output from stdout into a blackhole.

So right now you are trying to send emails from your dev machine? I try to avoid this, as accidents are going to happen and you'll send clients test data.

Try Mailcatcher http://mailcatcher.me/

It lets you catch all the emails your app would be sending shows them off in a nice web interface and importantly avoids the risk of accidentally sending real emails to customers with random test data.


SMTP server's (even Gmail) response can really take some time. You'd rather use a mail queue that stores all emails in a database and then they are sent by an independent process.

E.g. https://github.com/beam/action-mailer-queue

Concerning logger - make sure that your logging level is :error or :fatal. If not, run:

config.log_level = :error


config.logger = Logger.new('log/development.log')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜