The .NET Framework does not provide more options [1] for receiving a stacktrace than for using the StackTrace class, either directly, or through Exception or Environment.StackTrace as a string, so there is a bit more NLog can do. In addition, the call flow will (potentially) be different for each call to the log. The only exception is the call to the log inside the loop. But even in this case, some equipment will be needed to help NLog even know that the call was made from "the same place" as the previous one. This could only be determined by searching (again) in a callstack.
So, in general, I would suggest that NLog should do just that: grab a callstack on every call to the log (although not for every layout / appender that handles the call) - just like log4net, by the way, warns "about this an option that is a performance issue with a high log call frequency.
In any case, you can look at the source, which also indicates (although I did not go through it in the debugger) that there is one column in each log call.
UPDATE . For completeness of use, starting with .NET 4.5, you can use attributes of subscriber information attributes . They have their own "limitations", although, like not including typename. However, they are not currently used by NLog.
[1] Except, perhaps, using some rewriting of the IL level or launching the application in the debugger.
source share