【发布时间】:2012-09-24 09:32:03
【问题描述】:
我正在尝试将 NLog 用于我的 WindowsFormsControlLibrary,但它不起作用。有没有办法提供登录使用我的 Control.dll 的 .exe 应用程序?
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- make sure to set 'Copy To Output Directory' option for this file -->
<!-- go to http://nlog-project.org/wiki/Configuration_file for more information -->
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/${shortdate}/file.txt"
layout="${stacktrace} ${longdate} ${message}" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="file" />
</rules>
</nlog>
【问题讨论】:
-
“不起作用”不是错误描述。你有什么问题?此外,请出示您的日志记录代码
-
我发现以下决定:在您的应用程序中创建 NLog 实例(而不是在 .dll 中)并在您的 dll 中简单地使用它。不要在控件中创建 nlog 实例!
标签: c# .net logging user-controls nlog