Log exceptions stack trace if possible