PostSharp诊断工具包-可以更改消息格式吗? [英] PostSharp Diagnostics Toolkit - Can the message format be changed?

查看:62
本文介绍了PostSharp诊断工具包-可以更改消息格式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将PostSharp Diagnostics Toolkit与Log4Net一起使用,并且运行非常正常.但是,输出每行两次包含名称空间和类.

I'm using the PostSharp Diagnostics Toolkit with Log4Net and it is working verynicely. However, the output contains the namespace and class twice on each line.

Log4Net配置为使用标准模式布局

Log4Net is configured to use a standard pattern layout

<layout type="log4net.Layout.PatternLayout">
  <conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>

这将产生输出:

2012-11-15 11:03:22,992 [ServerScheduler_Worker-3] DEBUG MyNamespace.MyClass - Entering: MyNamespace.MyClass.MyMethod(DateTime date = {11/15/2012 00:00:00})

注意重复MyNamespace.MyClass.我确实希望Log4Net为不是由PostSharp注入的日志语句输出%logger(命名空间和类).

Notice MyNamespace.MyClass is repeated. I do want Log4Net to output the %logger (namespace and class) for log statements not injected by by PostSharp.

如何配置PostSharp仅输出方法名称而不是完整的namespace.classname.methodname?

How can I configure PostSharp to only output the method name rather than the full namespace.classname.methodname?

推荐答案

这很不错.当前无法对其进行自定义.我在我们的待办事项列表中添加了一个用户故事.

This is a good point. It is not possible to customize it currently. I added a user story to our backlog.

这篇关于PostSharp诊断工具包-可以更改消息格式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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