Fixed -k argument in single-threaded mode
Allow logging to go to files nicely

This is actually a substantial change to the log handling system.