Unify and clean up shutdown, remove log_setup code, notify startup and shutdown.
Unify and clean up shutdown.