Skip to content

HttpLoggingPolicy supports integrating logs into one record #19925

@freeloop914

Description

@freeloop914

I'm using azure function app and using SDK to operate Azure resources like blob list/download.
I need these HTTP request/response logs for troubleshooting debug.
But currently they are separated to multiple records.
It's very difficult to query.

For example, this is what current log looks like:

[7/29/2020 6:55:16 PM] Request URL: 'https://xxx.documents.azure.com:443/'
[7/29/2020 6:55:16 PM] Request method: 'GET'
[7/29/2020 6:55:16 PM] Request headers:
[7/29/2020 6:55:16 PM]     'Cache-Control': 'no-cache'
[7/29/2020 6:55:16 PM]     'x-ms-version': 'REDACTED'
[7/29/2020 6:55:16 PM]     'x-ms-documentdb-query-iscontinuationexpected': 'REDACTED'
[7/29/2020 6:55:16 PM]     'x-ms-consistency-level': 'REDACTED'
[7/29/2020 6:55:16 PM]     'x-ms-session-token': 'REDACTED'
[7/29/2020 6:55:16 PM]     'x-ms-date': 'REDACTED'
[7/29/2020 6:55:16 PM]     'authorization': 'REDACTED'
[7/29/2020 6:55:16 PM]     'Accept': 'application/json'
[7/29/2020 6:55:16 PM]     'Content-Length': '0'
[7/29/2020 6:55:16 PM]     'User-Agent': 'azsdk-python-cosmos/4.0.0 Python/3.8.5 (Windows-10-10.0.19041-SP0)'

What I expect is :

[7/29/2020 6:55:16 PM] Request URL: 'https://xxx.documents.azure.com:443/'
 Request method: 'GET'
 Request headers:
     'Cache-Control': 'no-cache'
     'x-ms-version': 'REDACTED'
     'x-ms-documentdb-query-iscontinuationexpected': 'REDACTED'
     'x-ms-consistency-level': 'REDACTED'
     'x-ms-session-token': 'REDACTED'
     'x-ms-date': 'REDACTED'
     'authorization': 'REDACTED'
     'Accept': 'application/json'
     'Content-Length': '0'
     'User-Agent': 'azsdk-python-cosmos/4.0.0 Python/3.8.5 (Windows-10-10.0.19041-SP0)'

It looks more clean and tidy ( At least from Azure function app Monitoring Log interface. )
and when I query the log by

trace | where message contains 'Request URL'

I can get useful and related information instead of one line meaning nothing.

Metadata

Metadata

Assignees

Labels

Azure.CoreClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-requestThis issue requires a new behavior in the product in order be resolved.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions