exception logging: issue #678

added exception logging in debug mode