This project is archived and is in readonly mode.

Logging from rake tasks is broken in production environment
Reported by Michael Lovitt | July 3rd, 2008 @ 01:53 PM | in 2.x
To reproduce, create a fresh Rails project, put the attached test_logging.rake file inside /lib/tasks, and then run:
rake test_logging RAILS_ENV=production
The test_logging task calls RAILS_DEFAULT_LOGGER.info, so the logged text should appear in the production.log file, but it does not.
I've reproduced in 2.0.2 and 2.1. Other folks have reported the same problem here:
Comments and changes to this ticket
- 
         Michael Lovitt July 3rd, 2008 @ 01:56 PM- no changes were found...
 
- 
         josh October 5th, 2008 @ 03:18 PM- State changed from new to wontfix
 
- 
            
         David Muir October 30th, 2009 @ 05:13 AMeh? why is this a wontfix? 
 I just wasted half my day trying to figure out why I wasn't getting any logs...
 Can this be overridden via the production.rb?
 If not, is my only option to run all my rake tasks in development mode?
- 
         Ryan Bigg April 2nd, 2011 @ 12:32 AM- State changed from wontfix to open
- Importance changed from  to 
 This is still happening. This should not be marked as "wontfix" without a good reason. 
- 
         Ryan Bigg April 2nd, 2011 @ 12:36 AMIf you come across this error, it's because you're not flushing the log output. Use this which will automatically flush the log on every log call: Rails.logger.auto_flushing = true 
- 
         Ryan Bigg April 2nd, 2011 @ 12:36 AM- State changed from open to resolved
 
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
 Jeremy Kemper
      Jeremy Kemper
 josh
      josh
 Manfred Stienstra
      Manfred Stienstra
 Michael Lovitt
      Michael Lovitt
 Piotr Sarnacki
      Piotr Sarnacki
 Ryan Bigg
      Ryan Bigg