puts doesn't print stuff to console puts doesn't print stuff to console ruby ruby

puts doesn't print stuff to console


Instead of puts, try logger.info(). Logging in Rails is very flexible, but it does mean that you might not be able to use the simplest tools sometimes.


If you're doing debugging and only want to see some messages in the logs you can do the following:

Rails.logger.debug("debug::" + person.name)

and

$ pow logs | grep debug::

now you'll only see logging messages that start with debug::


Another option is to use the rails tagging logger, http://api.rubyonrails.org/classes/ActiveSupport/TaggedLogging.html.

logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))logger.tagged('BCX') { logger.info 'Stuff' }                            # Logs "[BCX] Stuff"$ pow logs | grep BCX