Pre-allocate logs into a temporary file to avoid racing. #1373