- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25.1k
Open
Labels
Pri2Source - Docs.msDocs Customer feedback via GitHub IssueDocs Customer feedback via GitHub Issueaspnet-core/svcdoc-enhancementfundamentals/subsvc
Description
Description
The example I'm referring to is:
[HttpGet("{id}")]
public async Task<ActionResult<TodoItemDTO>> GetTodoItem(long id)
{
    TodoItem todoItem;
    var transactionId = Guid.NewGuid().ToString();
    using (_logger.BeginScope(new List<KeyValuePair<string, object>>
        {
            new KeyValuePair<string, object>("TransactionId", transactionId),
        }))
    {
        _logger.LogInformation(MyLogEvents.GetItem, "Getting item {Id}", id);
        todoItem = await _context.TodoItems.FindAsync(id);
        if (todoItem == null)
        {
            _logger.LogWarning(MyLogEvents.GetItemNotFound, 
                "Get({Id}) NOT FOUND", id);
            return NotFound();
        }
    }
    return ItemToDTO(todoItem);
}
How is TransactionId used in the example? There is no explanation as to what would would be logged as a result of adding it either, giving the impression that the following is logged:
"Getting item X"
Could either the example be updated to show how TransactionId would be used, or provide clarity how TransactionId is used if it is used at all in the example?
Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-8.0
Content source URL
Document ID
726e3bf1-f367-d733-8933-bccc04da0e16
Article author
Metadata
Metadata
Assignees
Labels
Pri2Source - Docs.msDocs Customer feedback via GitHub IssueDocs Customer feedback via GitHub Issueaspnet-core/svcdoc-enhancementfundamentals/subsvc
Type
Projects
Status
In progress