Skip to content

Commit

Permalink
Merge pull request #1403 from NLog/fix-thread-aborted-exception2
Browse files Browse the repository at this point in the history
Fix filetarget: Thread was being aborted (#2)
  • Loading branch information
304NotModified committed Apr 26, 2016
2 parents d36fd97 + 914fb1b commit 7cf3795
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/NLog/Targets/FileTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,14 @@ private void RefreshArchiveFilePatternToWatch()
{
Thread.Sleep(200);
}
catch (ThreadAbortException ex)
{
//ThreadAbortException will be automatically re-thrown at the end of the try/catch/finally if ResetAbort isn't called.
Thread.ResetAbort();
InternalLogger.Trace(ex, "ThreadAbortException in Thread.Sleep");
}
catch (Exception ex)
{
//non-critical, this could be a ThreadAbortException
InternalLogger.Warn(ex, "Exception in Thread.Sleep, most of the time not an issue.");
}
Expand Down

0 comments on commit 7cf3795

Please sign in to comment.