1

More precisely, I want all logger.info/debug/etc messages to be shown only in *.log file, but not in console window. Thanks.

UPD:
I dont want suppress all of console output, E.g. I want use letters gem to put my own output to console, also I want to use debugger which wont work with stdout redirected to /dev/null. I just want rails do not output Rails.logger messages to stdout (requests, ActiveRecord SQL queries, etc), Actually I can see such messages in log-file if needed.

4
  • possible duplicate of How to disable console output on Rails 3 development server? Commented Jan 11, 2013 at 6:33
  • No, its not. I dont want suppress all of console output, E.g. I want use letters gem to put my own output to console, also I want to use debugger which wont work with stdout redirected to /dev/null. I just want rails do not output Rails.logger messages to stdout (requests, ActiveRecord SQL queries, etc), Actually I can see such messages in log-file if needed. Commented Jan 11, 2013 at 6:53
  • Yes, I do that. It's exactly why I dont want to see the same output twice. Commented Jan 11, 2013 at 7:04
  • This is surprisingly hard to do. Looking into it for you. Commented Jan 11, 2013 at 8:54

1 Answer 1

6

Put the following line into your <environment>.rb under config/environments. E.g. for development, the following goes into development.rb

config.logger = Logger.new('/path/to/log/development-nostdout.log')

This overrides the default logger.

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah! Its cool & painless solution! Thank you very much! PS: It don't work in case when the logger redirected to log/development.log, it needs another log-file.
This was surprisingly hard to find.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.