Skip to content

Commit

Permalink
Merge pull request Topshelf#201 from solyutor/flushbuffers2
Browse files Browse the repository at this point in the history
Flush log buffers if HostFactory.New()/Run() throws an exception.
TravisTheTechie committed Sep 19, 2014
2 parents c2d6b29 + 89a6a22 commit 856c18a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Topshelf/HostFactory.cs
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ public static Host New(Action<HostConfigurator> configureCallback)
catch (Exception ex)
{
HostLogger.Get(typeof(HostFactory)).Error("An exception occurred creating the host", ex);
HostLogger.Shutdown();
throw;
}
}
@@ -82,7 +83,8 @@ public static TopshelfExitCode Run(Action<HostConfigurator> configureCallback)
{
HostLogger.Get(typeof(HostFactory))
.Error("The service terminated abnormally", ex);

HostLogger.Shutdown();

return TopshelfExitCode.AbnormalExit;
}
}

0 comments on commit 856c18a

Please sign in to comment.