行号在NLog日志中的生产中消失 [英] line numbers are disappear on production in the NLog logs

查看:707
本文介绍了行号在NLog日志中的生产中消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过使用$ {callsite}参数将NLog布局配置为具有方法名称和行号,并且在本地的效果很好,如下所示.

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)

但是它正在更改为Application_Start,生产时没有行号.我猜是因为没有.pdb文件就无法访问行号,但是我使用的是.NET 4.5,它可以通过没有.pdb文件的调用者属性来访问行号.而且我了解NLog尚未针对.NET 4.5进行优化.

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.

是否可以使用NLog在.NET 4.5的生产中添加行号?

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

推荐答案

NLog在.NET 4.5中不使用新属性

NLog does not use the new attributes in .NET 4.5

它使用 StackTrace 类.

源代码.

因此,您需要.pdb文件作为行号.

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

这篇关于行号在NLog日志中的生产中消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆