Minor cleanups.

refs #209
Add helper functions for logging.

refs #209
Print message to logfiles upon shutdown.

refs #209
Report to errorlog if pidfile writing fails.

refs #209