You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
EventListener is filtering at LogAlways verbosity has special cased behavior that should be appropriately documented #2445
EDIT: Originally I believed the special case behavior of LogAlways filtering in EventListener was in error and filed this bug to fix it. However it actually aligns with ETW behavior and past precedent so I now consider the existing behavior to be by-design. Instead this issue is repurposed to cover updating the docs so that they accurately describe the behavior as it exists. Below is my original bug report that shows the difference in behavior, even though I no longer plan to change it.
In EventListener, calling EnableEvents(eventSource, level) is intended to filter events so that only events equally or more severe than level invoke the OnEventWritten callback. However that filtering doesn't appear to be happening.
changed the title [-]EventListener is not filtering events from EventSource[/-][+]EventListener is not filtering events from EventSource when enabled at LogAlways verbosity[/+]on Apr 17, 2021
The severity level of the events to write to the channel. The service writes events to the channel that have a level value that is less than or equal to the specified value. The default is 0, which means to log events with any level value.
The session passes the level value to the provider when it enables the provider.
That makes me wonder whether there is a risk that removing the special handling of LogAlways from .NET makes an event provider not comply with this Windows documentation.
However, EnableCallback and EnableTrace do not document this interpretation of a zero level. I don't know whether the documentation is incomplete or Windows Event Log maps the zero level in the manifest to a different value before it calls EnableCallback.
@KalleOlaviNiemitalo - thanks! I did a little testing with ETW and I do see results suggesting that LogAlways is a special cased value there. I am going to reach out to one of the devs on Windows ETW team and see if I can get confirmation that the special casing is by design. If so then it probably means we have a bunch of documentation that is wrong and we'll repurpose the bug to address that instead.
I did confirm with the ETW team that setting a level of LogAlways on a provider is treated as a special case that does no level-based filtering. I am taking a look through the runtime's code to see how our logic compares in other situations to figure out what we do next.
I concluded we shouldn't make behavioral changes here for 6.0, instead we should pursue doc changes. Updating the title accordingly. Thanks for the timely and helpful info @KalleOlaviNiemitalo : )
changed the title [-]EventListener is not filtering events from EventSource when enabled at LogAlways verbosity[/-][+]EventListener is filtering at LogAlways verbosity has special cased behavior that should be appropriately documented[/+]on Jul 21, 2021
Activity
[-]EventListener is not filtering events from EventSource[/-][+]EventListener is not filtering events from EventSource when enabled at LogAlways verbosity[/+]Stop special casing LogAlways
KalleOlaviNiemitalo commentedon Jul 14, 2021
The special handling of LogAlways seems consistent with Windows Event Log ChannelPublishingType Complex Type:
That makes me wonder whether there is a risk that removing the special handling of LogAlways from .NET makes an event provider not comply with this Windows documentation.
However, EnableCallback and EnableTrace do not document this interpretation of a zero level. I don't know whether the documentation is incomplete or Windows Event Log maps the zero level in the manifest to a different value before it calls EnableCallback.
noahfalk commentedon Jul 14, 2021
@KalleOlaviNiemitalo - thanks! I did a little testing with ETW and I do see results suggesting that LogAlways is a special cased value there. I am going to reach out to one of the devs on Windows ETW team and see if I can get confirmation that the special casing is by design. If so then it probably means we have a bunch of documentation that is wrong and we'll repurpose the bug to address that instead.
noahfalk commentedon Jul 14, 2021
I did confirm with the ETW team that setting a level of LogAlways on a provider is treated as a special case that does no level-based filtering. I am taking a look through the runtime's code to see how our logic compares in other situations to figure out what we do next.
noahfalk commentedon Jul 21, 2021
I concluded we shouldn't make behavioral changes here for 6.0, instead we should pursue doc changes. Updating the title accordingly. Thanks for the timely and helpful info @KalleOlaviNiemitalo : )
[-]EventListener is not filtering events from EventSource when enabled at LogAlways verbosity[/-][+]EventListener is filtering at LogAlways verbosity has special cased behavior that should be appropriately documented[/+]mikelle-rogers commentedon Mar 4, 2022
EventListener (it is mentioned but not descried). Include [init behavior] (dotnet/runtime#38804 (comment)). As mentioned in #515
Add EventSource docs
Add EventSource docs
Add EventSource docs
Add EventSource docs
Add EventSource docs
Add EventSource docs
Add EventSource docs
Add EventSource docs
Add EventSource docs
Add EventSource docs (#28826)
Clarify EventLevel.LogAlways
noahfalk commentedon Apr 7, 2022
Docs added dotnet/dotnet-api-docs#7924