-
Notifications
You must be signed in to change notification settings - Fork 6k
Add log buffering docs #46232
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
base: main
Are you sure you want to change the base?
Add log buffering docs #46232
Conversation
1ad5e4b
to
b8fb0b7
Compare
b8fb0b7
to
5cbf2fc
Compare
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.
Simple typo and grammatical suggestions.
- Buffers logs from categories starting with `PerRequestLogBufferingFileBased.` with level <xref:Microsoft.Extensions.Logging.LogLevel.Information?displayProperty=nameWithType> and below. | ||
- Sets an auto-flush duration of 5 seconds after manual flushing. | ||
|
||
To register the log buffering with the configuration, consider the following code:: |
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.
To register the log buffering with the configuration, consider the following code:: | |
To register the log buffering with the configuration, consider the following code: |
> [!NOTE] | ||
> Log buffering is available in .NET 9 and later versions. | ||
|
||
Log buffering works with all logging providers. If a logging provider you use does not implement the <xref:Microsoft.Extensions.Logging.Abstractions.IBufferedLogger> interface, log buffering will be calling log methods directly on every single buffered log record when flushing the buffer. |
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.
Log buffering works with all logging providers. If a logging provider you use does not implement the <xref:Microsoft.Extensions.Logging.Abstractions.IBufferedLogger> interface, log buffering will be calling log methods directly on every single buffered log record when flushing the buffer. | |
Log buffering works with all logging providers. If a logging provider you use does not implement the <xref:Microsoft.Extensions.Logging.Abstractions.IBufferedLogger> interface, log buffering will call log methods directly on every single buffered log record when flushing the buffer. |
|
||
- If the buffer is full, the oldest logs will be dropped and never emitted. | ||
- If you want to emit the buffered logs, you can call `Flush()` on the `GlobalLogBuffer` or `PerRequestLogBuffer` class. | ||
- If you never flush buffers, the buffered logs will eventually be dropped as application runs, so it effectively behaves like those logs are disabled. |
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.
- If you never flush buffers, the buffered logs will eventually be dropped as application runs, so it effectively behaves like those logs are disabled. | |
- If you never flush the buffers, the buffered logs will eventually be dropped as the application runs, so it effectively behaves like those logs are disabled. |
Summary
Fixes #46231
Internal previews