Fix a bug that caused duplicate log lines to appear.

This bug happened after deleting and re-creating the log file.