Separate out writing to log file.