1

I have

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);

I need to add skipframe=1 on callsite in order to see the actual class that called the NLog methods.

Is there a way to do that?

Julian
  • 30,223
  • 19
  • 105
  • 147

1 Answers1

1

As confirmed, LogManager.AddHiddenAssembly(..) works in this case:

Example:

LogManager.AddHiddenAssembly(typeof(LoggingExtensions).Assembly);

Call this method as soon as possible, e.g in main() or app_start()

Julian
  • 30,223
  • 19
  • 105
  • 147