Log exception to console if needed and to file as error