Start writing the log in the memory starting from the end of the log (inversed loop)
or at least write the first byte of the sequential ID at last so that at boot you can check whether it is F or not. If it is F, it means that the log is corrupted.
At boot, retrieve the second to last log and not the last one, so that you are sure it is not corrupted. You lose 10s but it ain't critical.