Don't crash when logging to tty.
Merge bug26472
stable to default