put all log created by the varios functions into files named after
their stage lockfile. At the end of the function, redirect log
back to the global LOGFILE, after their stage logfile got appended to
it.
Use the stage logfile in the ERRtrap, so whenever an error happen the
stuff that gets mailed is the short part that happens to be around the
error, not the whole long stuff the complete dinstall log happens to be.