Restore and adapt the implementation reverted at
https://github.com/rails/rails/commit/cc1c3c5be061e7572018f734e5239750ab449e3f

Now instead of raise, we log by default in development and test