[2.2] Support for rolling logs

This replaces #3009 that was messed up. 

Adds support for rolling logs. When the log is rolled over diagnostics information is added to the top of the new log.

Sure, but does your changes keep the behavior of printing store upgrade progress to System.out somehow? It's a user-facing thing, I think.