适用于 Windows 目标的 NLog 和 Growl
我正在尝试使用可以找到的目标http://ryanfarley.com/blog/archive/2010/05/06/announcing-the-growl-for-windows-target-for-nlog.aspx。我的 nlog 框架像以前一样工作,我添加了咆哮的配置行,一切正常。
配置文件是
<?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" autoReload="true" throwExceptions="true">
<extensions>
<add assembly="NLog.Targets.GrowlNotify" />
</extensions>
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/log.txt" />
<target name="growl" xsi:type="GrowlNotify" password="" host="localhost" port="" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="growl" />
</rules>
</nlog>
但是,当我添加咆哮的配置行时,我不断收到异常“System.ArgumentException:未找到目标 GrowlNotify”。当项目启动时。这 3 个额外文件位于 bin 目录中(加上 nlog.dll 和 nlog.xml 文件)。
我正在使用 dotNet Framework v4 并使用 VS2010。
有人有任何可能导致此问题的想法吗?
I am trying to use the target which can be found http://ryanfarley.com/blog/archive/2010/05/06/announcing-the-growl-for-windows-target-for-nlog.aspx. I have the nlog framework working as before I add the config lines for growl all works fine.
The config file is
<?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" autoReload="true" throwExceptions="true">
<extensions>
<add assembly="NLog.Targets.GrowlNotify" />
</extensions>
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/log.txt" />
<target name="growl" xsi:type="GrowlNotify" password="" host="localhost" port="" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="growl" />
</rules>
</nlog>
However when I add the config lines for growl I keep getting the exception "System.ArgumentException: Target GrowlNotify not found." when the project starts up. The 3 extra files are in the bin directory (plus the nlog.dll and nlog.xml files).
I am using dotNet framework v4 and using VS2010.
Does anybody have any ideas that might be causing this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了在网络应用程序中使用它。我们需要将配置更改如下。将端口=“”更改为端口=“0”。这是因为在 nLog 中,它会尝试将端口类型转换为 int32,当我们提供空字符串时,它会生成错误。
In order to use it in a web app. We need to change the config as the following. Change port = "" to port = "0". This is because in nLog, it will try to convert the type of the port to int32 and when we supplies an empty string, it will generate the error.
为了使用 GrowlNotify 目标,您需要安装 NLOG v2,该版本仍处于测试阶段,并且不是默认下载。哎哟!我的不好。希望这能阻止其他人每天浪费 1/2 的时间来拉扯他留下的那点头发:(
In order to use the GrowlNotify target you need NLOG v2 installed which is still in beta and is not the default download. Doh! My bad. Hopefully this will stop somebody else wasting 1/2 a day pulling what little hair he has left out :(