Fixes log and records rotation to only happen if there's a file