Add option to redirect stdout and stderr to a file

When using a daemon, stdout and stderr are redirected to /dev/null.
If the program generates an exception and crashes, we can't get the
message. This option allows to get everything from stdout and stderr in
a file.