Added support for dumping  to log on error.