Making the recording logger less prone to race conditions