Search code examples
.netlog4netpostsharp

PostSharp Diagnostics Toolkit - Can the message format be changed?


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 is configured to use a standard pattern layout

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

This is producing the output:

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})

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

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


Solution

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