Reputation: 1015
In nLog I am able to setup (in nlog.config or via Code) some so called ConditionBasedFilters
like:
<filters defaultAction='Log'>
<when condition="equals('${event-context:item=EventId}','Microsoft.EntityFrameworkCore.Model.Validation.DecimalTypeKeyWarning')" action="Ignore" />
</filters>
With this I can filter log messages based on the actual LogMessage
or EventId
etc. (see
Official nLog doku: https://github.com/NLog/NLog/wiki/Filtering-log-messages#example-in-c )
Is there some similar feature in asp.net core Logging? (see: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-5.0#how-filtering-rules-are-applied )
As far as I can see it only supports filtering on LogLevel
, Category
and Provider
but not on for instance the actual LogMessage
or EventId
- Is there some feature, that I am missing?
Upvotes: 3
Views: 701
Reputation: 51
This filter works for me:
<when condition="equals('${event-properties:item=EventId}',99150001)" action="Ignore" />
Upvotes: 0