NLog with Growl for Windows target

873 Views Asked by At

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?

2

There are 2 best solutions below

1
On BEST ANSWER

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 :(

0
On

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>