added ability to output debug log to a file and also to grep the output
to a specific pattern.