RSS 2.0 Feed
RSS 2.0


Atom 1.0 Feed
Atom 1.0

  Announcing the Growl for Windows Target for NLog (and another reason to love Growl) 

I love Growl. In my opinion it is something that should be built into the OS and I wish that every app supported sending Growl notifications. Lately I have been using Growl to get notifications from my own applications. This has been a great way to get instant feedback from applications while testing or when problems happen. However, instead of building in support for Growl, I add these notifications via a custom target for NLog so the notifications are configurable as part of the logging solution.

What is Growl for Windows?

First of all, for those who are not familiar with what Growl is, you're missing out. Take a look at Growl's About page to find out more. Basically, it is a Windows version of the Mac growl notification system that displays notifications using the GNTP protocol. Growl gives you notifications when things happen. It can be something from your machine or something on some other machine on the network. Think of it as a uniform notification system that any application can use.

Using Growl as a Logging Notification Target

So, back to my original topic. I use NLog for logging. For logging, NLog is awesome (why I prefer it to log4net will require another post). Some of the things that make Growl for a logging target useful for me:
  1. Instant feedback while testing applications. I can get details about what is going on in my application while testing, whether I am debugging or not by simply turning on my Growl target in the NLog.config file.
  2. If the application is running on a server, I can have the application send fatal or error logging notifications right to my desktop. If my server app has a fatal problem it will get logged, but I get the instant feedback with a Growl notification on my desktop.
The custom GrowlNotify target for NLog

Let's take a look at my simple custom NLog logging target for Growl. To use the GrowlNotify target in NLog, all you have to do is download the GrowlNotify binaries, place them in the same folder as your app (no need to add them as references, just put them where the NLog.dll and NLog.config are), then wire it up as a target in the NLog.config file. Here is a sample configuration for using the GrowlNotify target:

<?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">

<extensions>
<add assembly="NLog.Targets.GrowlNotify" />
</extensions>

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

<rules>
<logger name="*" minLevel="Trace" appendTo="growl"/>
</rules>

</nlog>

That configuration will send any level of logging event to Growl on the same/local machine. To have the Growl notification sent over the network, all you have to do is fill in the parameters for "password", "host" (with a machine name or IP address), and optionally the "port" (if you've changed your Growl port from the default). That is it.

Each logging level has it's own icon. Here's some screenshots of NLog GrowlNotify in action:



     

     

     

Of course, once you've used GrowlNotify once and the DLL has registered itself with Growl, you'll be able to tweak things for each notification level in the Growl applications list, such as making the more critical levels play a different sound, etc:






                   



Leave a comment below.

Comments

  1. Arthur 5/7/2010 9:08 PM
    Gravatar
    Cool post Ryan thank you,

    this combination opens a whole new world of collaboration capabilities!
  2. João Almeida 5/10/2010 6:36 AM
    Gravatar
    Totally agree, Windows, like OSX or Linux, should have a unified notification system (although I still prefer Snarl's look and feel over Growl), and this little extension is a fine example of all the cool things we could have available.
  3. vyas 6/28/2010 3:17 AM
    Gravatar
    Hi Ryan ,

    Can you explain or put in a sample code in brief like how to use Growl in NLog configuration.


    Thanks in advance,
    Vyas
  4. Jonathan Stanton 6/29/2010 3:52 PM
    Gravatar
    Hi there, Thanks for this but I am having problems when trying to load the extention. I keep getting the exception "System.ArgumentException: Target GrowlNotify not found." when I create an instant of a logger. The nlog framework is working as it logs when I don't use the growl extention.

    I am using dotNet 4 (I don't know if that is a known issue).

    Any suggestions what might be causing this

    Many thanks

    Jonathan
  5. Ryan Farley 7/5/2010 12:43 PM
    Gravatar
    vyas, The github repo has a demo app you can try to see a sample config file and sample code.

    Jonathan, I can use this just fine with .NET 4 framework. It is likely the placement of the DLL that is the problem. I'll reply on the github issue with further details http://github.com/RyanFarley/NLogGrowlNotify/issues#issue/1
  6. Jonathan Stanton 7/19/2010 2:35 AM
    Gravatar
    Thanks. I traced the problem down to me using the wrong version of NLog. I was using the Stable V1 release not the Beta V2 version.
  7. Ryan Farley 7/19/2010 9:06 AM
    Gravatar
    Thanks for letting me know Jonathan.
  8. Wholesale baseball hats 8/19/2010 11:50 PM
    Gravatar
    These are wonderful! Thank you for finding and sharing
  9. jing 8/26/2010 8:42 PM
    Gravatar
    From the rudimentary score of your western theme wedding dresses, in attendance is a destiny extra headed for consider. heaps of factors encouragement the form in addition to tally of the ivory lace wedding dresses, counting color, neckline, insulation type, plus skirt length.
    se, the a large amount usual dye representing brides is individual of the hundreds of shades of white. In topical years, however, countless brides boast been experimenting together with dye in their
    western style wedding dresses.

Leave a comment

Please be polite and on topic. Your e-mail will never be published.

Please add 5 and 5 and type the answer here:



 

News


Also see my CRM Developer blog

Connect:            

Sponsor

Sections