-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception logging for MessageReceiver background exceptions #1704
Conversation
8cdcf08
to
b9e54ef
Compare
int deliveryCount, | ||
ILogger log) | ||
{ | ||
log.LogInformation($"Processing ServiceBus message (Id={messageId}, DeliveryCount={deliveryCount})"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this sample function to repro the issue. Before my changes, if I introduced a 7 minute delay in this function, the lock would be lost and I'd get retries without any error messages. With my changes the MessageLockLostException from SB is logged to console.
{ | ||
if (!e.Exception.IsWrappedExceptionTransient()) | ||
{ | ||
context.Trace.Error($"MessageReceiver error (Action={e.Action})", e.Exception); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that the TraceWriter is all wired up to AppInsights if AI is enabled @brettsam ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In v2.x
, you need to do the ugly double-logging to both TraceWriter
and ILogger
. In dev
it's just ILogger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to conditionally log to ILogger as well :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to log to ILogger in the place mentioned. Other than that, looks good.
b9e54ef
to
48aebe5
Compare
Addresses #1703
I'll be making similar changes in v2