clean up some system_call invocations.

Should set log file once using set_log, not by passing in additional
log_file arguments.
tighten up scoping: use my instead of our.
clean up a couple more system_call invocations.
Still trying to decide the best test...switching to which.
tiny reorg: elsif logfile, instead of if logfile.