Factor out configuration file parsing and logging setup.

Reduce duplicated code in each command-line script into a new module.

Change-Id: I8316d349c6b2cab3717611e52a4ed70616082f88