如何在Rails 3开发服务器上禁用控制台输出? [英] How to disable console output on Rails 3 development server?

查看:89
本文介绍了如何在Rails 3开发服务器上禁用控制台输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Rails 3应用程序上禁用控制台输出?
更具体地说,我想至少禁用Mailer输出,该输出输出包括图片在内的整个电子邮件内容,从而使操作处理慢得多(发送电子邮件几乎需要10秒)。

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 the action processing much slower (it takes almost 10sec to send an email).

ps:我认为减速是由于输出,如果它可以来自其他来源,例如慢速smtp服务器(它是gmail atm,则不是)或类似的东西,请让我知道。

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.

推荐答案

这意味着您要隐藏控制台运行中显示的输出,您运行 rails s (或rails 2中的脚本/服务器)?

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)?

您是在Linux还是OSX上?

Are you on Linux or OSX?

如果是,那么只需执行以下操作

If so, then just do the following

$ rails server 1> /dev/null

这会将所有来自stdout的输出发送到黑洞中。

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.

尝试Mailcatcher
http://mailcatcher.me/

Try Mailcatcher http://mailcatcher.me/

它可以让您抓住您的应用程序要发送的所有电子邮件
都会在一个不错的Web界面
中显示出来,并且重要的是避免了意外向带有随机测试数据的客户意外发送真实电子邮件的风险。

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.

这篇关于如何在Rails 3开发服务器上禁用控制台输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆