Made sure nothing tries to use the logger before it's initialized. Added lots of logging messages, mostly debugs. Made some comments. Changed the exit/shutdown procedure.
Merge remote-tracking branch 'refs/remotes/origin/Logging' into dev