Added exception logging.

use `PHP_EOL` rather than `"\n"`