line numbers are disappear on production in the NLog logs

二次信任 提交于 2019-12-02 15:23:12

问题


I configured NLog layout for having method name and line number by using ${callsite} parameters and it works well locally as below.

Application_Start(Global.asax.cs:33)

But it is changing to Application_Start without line numbers on production. I guess that it is because of it can not access line numbers without .pdb files but i am using .NET 4.5 that makes possible to access line numbers via caller attributes without .pdb files. And i understand NLog haven't optimized itself for .NET 4.5.

Is there a way to put line numbers on production for .NET 4.5 with NLog ?


回答1:


NLog does not use the new attributes in .NET 4.5

It uses the StackTrace class.

This is evident from the source code.

As such, you need the .pdb files for the line numbers.



来源:https://stackoverflow.com/questions/21651710/line-numbers-are-disappear-on-production-in-the-nlog-logs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!