Synchronize log output and sync stdout