improved exception logging