How to retain callsite information when wrapping NLog

后端 未结 8 2169
感情败类
感情败类 2020-11-29 02:33

I have a class that wraps NLog (called NLogger). My logs are saved to my database. The thing I\'m having a problem with is how do I show where the logging occured. I have th

8条回答
  •  野性不改
    2020-11-29 03:08

    Nowadays a more simple approach to fix the callsite, is to use LogManager.AddHiddenAssembly(Assembly)

    e.g.

    LogManager.AddHiddenAssembly(yourAssembly);
    

    This will fix the callsite and no need to do manual stack walking etc.

提交回复
热议问题