Skip to content

Commit

Permalink
Flush log buffers if HostFactory.New or HostFactory.Run throw exception
Browse files Browse the repository at this point in the history
  • Loading branch information
solyutor committed Sep 2, 2014
1 parent c2d6b29 commit 89a6a22
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
Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 89a6a22

Please sign in to comment.