Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 按事件Id(或LogMessage)筛选日志_C#_Logging_.net Core - Fatal编程技术网

C# 按事件Id(或LogMessage)筛选日志

C# 按事件Id(或LogMessage)筛选日志,c#,logging,.net-core,C#,Logging,.net Core,在nLog中,我可以(在nLog.config或通过代码)设置一些所谓的conditionbasedFilter,例如: <filters defaultAction='Log'> <when condition="equals('${event-context:item=EventId}','Microsoft.EntityFrameworkCore.Model.Validation.DecimalTypeKeyWarning')" act

在nLog中,我可以(在nLog.config或通过代码)设置一些所谓的conditionbasedFilter,例如:

<filters defaultAction='Log'>
        <when condition="equals('${event-context:item=EventId}','Microsoft.EntityFrameworkCore.Model.Validation.DecimalTypeKeyWarning')" action="Ignore" />
</filters>

有了它,我可以根据实际的
LogMessage
EventId
等过滤日志消息(请参阅 官方nLog doku:)


asp.net核心日志记录中是否有类似的功能?(见:)


据我所知,它只支持在
LogLevel
Category
Provider
上进行过滤,但不支持在实际的
LogMessage
EventId
上进行过滤-是否有我缺少的功能?

根据,请不要在问题标题中添加标签。我已经为您从标题中删除了标签。@Llama thx!对不起,我还不知道。在搜索stackoverflow时,我经常看到“.net核心”问题。很抱歉,这可能会导致问题,无需担心。我只是想发表评论,让人们知道删除它不是恶意的,并让他们了解指南。:)