#15 NLog bridging doesn't work - patch

v2.0
open
Mark Pollack
logging (14)
5
2011-07-30
2011-07-30
Kenneth Xu
No

I was not able to get the CommonLoggingTarget to work, it seems that the the [Target] attribute was missing according to the NLog documentation. After I fixed this issue, further, the current implementation causes double formatting. e.g., nLog.Debug("Somthing {0}", "{0}") works fine with NLog along but fails with CommonLoggingTarget. BTW, the documentation about CommonLoggingTarget also need update.

I have attached the fixed file for review. It is working with below configuration:

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true" throwExceptions="true">
<extensions>
<add assembly="Common.Logging.NLog2"/>
</extensions>
<targets>
<target name="common.logging" type="CommonLogging" layout="${message}"/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="common.logging" />
</rules>
</nlog>

Let me know if you have any questions.

Thanks,
Kenneth

Discussion

  • Kenneth Xu
    Kenneth Xu
    2011-07-30