C# 如何为Sentinel日志查看器在NLogViewerTarget上设置skipframes调用站点
我有 我需要在callsite上添加C# 如何为Sentinel日志查看器在NLogViewerTarget上设置skipframes调用站点,c#,nlog,viewer,C#,Nlog,Viewer,我有 我需要在callsite上添加skipframe=1,以便查看调用NLog方法的实际类 有办法吗?经确认,LogManager.AddHiddenAssembly(…)在这种情况下起作用: 例如: LogManager.AddHiddenAssembly(typeof(LoggingExtensions.Assembly)) 尽快调用此方法,例如在main()或app\u start()中是否确实需要skipframe=1?你不能使用LogManager.AddHiddenAssembly
skipframe=1
,以便查看调用NLog方法的实际类
有办法吗?经确认,
LogManager.AddHiddenAssembly(…)
在这种情况下起作用:
例如:
LogManager.AddHiddenAssembly(typeof(LoggingExtensions.Assembly))代码>
尽快调用此方法,例如在main()
或app\u start()
中是否确实需要skipframe=1
?你不能使用LogManager.AddHiddenAssembly(..)
?这是可以做到的,但需要一些代码和配置谢谢你Julian。似乎AddHideenAssembly起了作用。还发现:我喜欢回答的问题,所以添加它作为答案;)
var sentinalTarget = new NLogViewerTarget()
{
Name = "sentinal",
Address = "udp://127.0.0.1:9999",
IncludeCallSite = true,
IncludeSourceInfo = true
};
sentinalTarget.Parameters.Add(new NLogViewerParameterInfo()
{
Name = "Callsite",
Layout = "${callsite:fileName=true:includeSourcePath=false:skipFrames=1}"
});
var sentinalRule = new LoggingRule("*", LogLevel.Trace, sentinalTarget);
LogManager.Configuration.AddTarget("sentinal", sentinalTarget);
LogManager.Configuration.LoggingRules.Add(sentinalRule);