Added exception logging.

I think it would better if this only did an `rtrim()` so that any content indented by the exception renderer will display as intended.  You can use `ctype_space()` to check if the line only contains whitespace and hence can be skipped.