Adding exception logging