How can I query the path to an NLog log file?

后端 未结 3 2500
余生分开走
余生分开走 2021-02-20 12:36

I\'ve configured a file target for NLog as follows:


  
    

        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-20 12:58

    I've just tried to get this information via the configuration api.

    enter image description here

    Sadly it looks like the configuration is evaluated by the actual target and is not resolved in the configuration.

    As {basedir} refers to the appdomain base directory you could simply read this value on your own.

    var basedirPath = AppDomain.CurrentDomain.BaseDirectory;
    

提交回复
热议问题