适用于 Windows 目标的 NLog 和 Growl

发布于 2024-09-07 22:49:43 字数 1184 浏览 6 评论 0原文

我正在尝试使用可以找到的目标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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事与诗 2024-09-14 22:49:43

为了在网络应用程序中使用它。我们需要将配置更改如下。将端口=“”更改为端口=“0”。这是因为在 nLog 中,它会尝试将端口类型转换为 int32,当我们提供空字符串时,它会生成错误。

<targets>
<target name="growl" type="GrowlNotify" password="" host="" port="0" />
</targets>

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.

<targets>
<target name="growl" type="GrowlNotify" password="" host="" port="0" />
</targets>
不…忘初心 2024-09-14 22:49:43

为了使用 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 :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文