Log exception first