Rodrigo Castro
Rodrigo Castro

Reputation: 1583

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 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.

Upvotes: 0

Views: 1890

Answers (3)

B Seven
B Seven

Reputation: 45943

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

Upvotes: 0

Jan Minárik
Jan Minárik

Reputation: 3267

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

Upvotes: 0

Matthew Rudy
Matthew Rudy

Reputation: 16834

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.

Upvotes: 6

Related Questions