Added support for gracefully handling maximum debug log errors and

support for writing out a json result file with test results and limit
usage (if debugging is enabled)

To output test results as json, set the TEST_JSON_OUTPUT environment to the file path where you want the output written.