add logging, and output to a file instead of to stdout