Skip to content

Commit

Permalink
Merge pull request Topshelf#196 from solyutor/flushbuffers
Browse files Browse the repository at this point in the history
Flush log buffers on unhandled exception
  • Loading branch information
haf committed Aug 24, 2014
2 parents d5894df + 4406dcf commit c2d6b29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Topshelf/Hosts/ConsoleRunHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ void CatchUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
_log.Fatal("The service threw an unhandled exception", (Exception)e.ExceptionObject);

HostLogger.Shutdown();

if (e.IsTerminating)
{
_exit.Set();
Expand Down
4 changes: 3 additions & 1 deletion src/Topshelf/Runtime/Windows/WindowsServiceHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ protected override void Dispose(bool disposing)
void CatchUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
_log.Fatal("The service threw an unhandled exception", (Exception)e.ExceptionObject);


HostLogger.Shutdown();

// // IF not terminating, then no reason to stop the service?
// if (!e.IsTerminating)
// return;
Expand Down

0 comments on commit c2d6b29

Please sign in to comment.