Stop logging to stdout unless we are running in the foreground