Allow for override of logger output on tests

Because surefire/maven don't flush output as it's generated making debugging impossible - idiots.
Introduce state machine.

Allows for validation of state transitions and improved logging.
Do not allow transitions out of shutdown state to avoid lifecycle problems.
Fix bug in watchdog timeout which could trigger invalidate state transitions.