【发布时间】:2016-09-23 19:55:00
【问题描述】:
我有一个通用类:
public class GenericClass<A>
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public void Blah(A a)
{
Logger.Info("Test log");
}
}
与简单的 NLog 配置一起使用:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="console" xsi:type="ColoredConsole" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="console" />
</rules>
</nlog>
我希望我的日志输出看起来像:
...|INFO|NLogTests.GenericClass<System.String>|Test log
相反,我看到的是:
...|INFO|NLogTests.GenericClass`1|Test log
如何让 logger 使用完全限定的类型名称而不是只显示泛型参数数量的基本名称?
【问题讨论】:
标签: nlog