rails/rails — pull request #3394 by bdurand (2011-10-21 19:25:08+00:00)
Title: Fix threading issues with BufferedLogger.

There are a couple of threading issues with ActiveSupport::BufferedLogger.

If a thread is spawned and logs messages but does not flush the log, the messages will never be written and will remain in the buffer forever.

```ruby
threads = []
urls.each do |url
threads << Thread.new do

logger.info("fetching #{url}")
fetch(url)
logger.info("#{url} retrieved")
end end
threads.each{|t| t.join}
```

Silencing a logger for a block in one thread will silence it will silence it for all other threads as well. This means in a multi-threaded Rails application, log messages can be lost.

(Note: this pull request was originally opened in Lighthouse at https://rails.lighthouseapp.com/projects/8994/tickets/6671)