Using GPF Reporter from a Windows Service app

Hi all.

I want to use the GPF Reporter template on an app that runs as a Windows Service. The template options allow for an email to be sent, but it seemingly needs UI interaction. As a service there won’t be UI interaction and all actions need to coded in. I may be able to pick up in the embeds for the global variable where a GPF report has been generated, and use the built-in email functions, or use the report content to send it myself. But I’m not sure where to do this, most of the embed points are for private methods and don’t seem to have a method for me to read the report content, or to set up the email credentials.

Any help on using GPF Report in a Windows Service will be great.


Its been a while since I last used GPFReporter, but one of the options was to generate a text file, so could you save that report in a folder and then have another app/service to look for new reports and then send them on via email?

You could probably do this with Nettalk, ie have a different service which monitors the folder for new reports and when it finds one, it sends it on via email automatically.

The forwarding service/process which detects a new report could also at the same, check to make sure the original service is still running. I know in window its possible to configure a service to restart automatically, but if the original service hangs, you need a separate service to kill the process and then restart it, because I dont think windows can tell when a service has hung.

You could also set up a pipe/file between the two services to poll each other to make sure everything is running properly.

Yes, a second service will be helpful to send the email. I should then also use a variable name for the output file, and untick “Ammend to Log File”, to get a new file every time a GPF occurred.

I still would have liked some embed point to get the report content. Have you managed to do this in code?


something like YYYYMMDD_HHMMSS.txt is useful for a log.

I only used it to send emails via outlook when I used it, but I also had to let Outlook and MS Exchange server accept input from my apps as this was locked down.

You’d have to ask @Bruce or check out the docs to see whether you can get at the contents.

What are you trying to get from the contents or are you looking to encrypt the contents before sending it out, to hide meta data from prying eyes?

There is also the SMTP email class that ships with clarion which could be used with a separate email server that accepts SMTP instead of using Nettalk.

As Richard says, you’re gonna use the log feature and email when the program starts, rather than on the gpf.

Make use of the restart-on-gpf feature, and simply send yourself the log in startup. Personally I wouldn’t use a different log file per incident, the built-in logging is designed to append, so with each event you’ll see the whole history, which can be really useful.

Spotting patterns like thread number, or keyboard etc. Plus complaints of “gpfs all the time” can be better understood as once-a-month or once-a-day and so on.

You won’t embed in self-service methods, you’ll embed the email sending after your program has started etc.