Reverting "Don't lose messages when opening a file for logging."
Revert "Don't lose messages when opening a file for logging."

This reverts commit 53ca47f15a0098c57048ab73f8e37be6d74ac958.