logging fix, shutdown improvement, misc tweaks

logging fix:
defer creation of sigpi, the pipe_fd, until after app configuration
fix logfile config, now that ordering is right

misc tweaks:
fix usage of reference on functions to avoid hack for void (*)()
throw informative exception on bad port number

enable orderly shutdown:
let taskid() return 0 when task system is unavailabe
do not actively close channel when task system is unavailable