我有
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);
我需要在callsite上添加skipframe=1
以查看调用NLog方法的实际类。
有办法吗?
答案 0 :(得分:0)
如上所述,LogManager.AddHiddenAssembly(..)
适用于这种情况:
示例:
LogManager.AddHiddenAssembly(typeof(LoggingExtensions).Assembly);
尽快调用此方法,例如main()
或app_start()