Add better logging support.

Now each peer logs its stdout and stderr to a file instead of dumping it out over the ssh connection's output.

Added hooks to copy the remote log files back to the local machine.

Also, k3 programs can now write files to a designated output directory, which will also be copied back to the local machine.
This is useful for checking the results of the sql queries.