• Work
  • Services
  • Blog
  • About
  • Contact
Singlebrook Singlebrook
☰ Menu
  • Work
  • Services
  • Blog
  • About
  • Contact

Write to Rails test log

March 14, 2011

Problem: You want to write to the Rails test log from within a TestCase.

Solution:
In Rails 3:

::Rails.logger.warn 'foobar'

Rails 2:

RAILS_DEFAULT_LOGGER.warn 'foobar'

Useful For: Viewing debugging output and standard log output (eg. AREL) in the same file.

More Information:

  • http://jasonseifer.com/2009/08/10/using-the-rails-logger-outside-of-models-and-controllers
  • http://mikenaberezny.com/2007/02/24/rails-logging-tips/
  • twitter
  • email
  • linkedin

Singlebrook is committed to the long-term success of our clients and their software.

We would love to develop your next product or improve your existing custom software!

Contact us now!
© Singlebrook Technology Inc.
Ithaca, NY, USA