Fixes #7571

This fixes #7571, tried and tested.
Do not write to stdout. Use Rails' logger if you want to log.