Skip to content

Commit

Permalink
added some more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhunt committed Sep 29, 2014
1 parent 8a58de7 commit c27a455
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions newrelic_perfmon_plugin/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using NewRelic.Platform.Sdk;
using NewRelic.Platform.Sdk.Utils;
using Topshelf;
using Topshelf.Runtime;
using System.Threading;
Expand Down Expand Up @@ -33,6 +34,8 @@ class PluginService
Runner _runner;
public Thread thread { get; set; }

private static Logger logger = Logger.GetLogger("newrelic_perfmon_plugin");

public PluginService()
{
_runner = new Runner();
Expand All @@ -41,23 +44,21 @@ public PluginService()

public void Start()
{
Console.WriteLine("Starting service.");

logger.Info("Starting service.");
thread = new Thread(new ThreadStart(_runner.SetupAndRun));
try
{
thread.Start();
//_runner.SetupAndRun();
}
catch (Exception e)
{
Console.WriteLine("Exception occurred, unable to continue. {0}\r\n{1}", e.Message, e.StackTrace);
logger.Error("Exception occurred, unable to continue. {0}\r\n{1}", e.Message, e.StackTrace);
}
}

public void Stop()
{
Console.WriteLine("Stopping service in 5 seconds.");
logger.Info("Stopping service.");
System.Threading.Thread.Sleep(5000);

if (thread.IsAlive)
Expand Down

0 comments on commit c27a455

Please sign in to comment.