#76 - Suppress shutdown error logs.

This commit is contained in:
Chris Ross 2014-10-24 12:15:07 -07:00
parent a42a069dcf
commit 6e2b94dde3
2 changed files with 15 additions and 2 deletions

View File

@ -64,6 +64,11 @@ namespace Microsoft.AspNet.Server.WebListener
} }
} }
internal static void LogVerbose(ILogger logger, string location, Exception exception)
{
LogVerbose(logger, location + "; " + exception.ToString());
}
internal static void LogException(ILogger logger, string location, Exception exception) internal static void LogException(ILogger logger, string location, Exception exception)
{ {
if (logger == null) if (logger == null)

View File

@ -122,9 +122,16 @@ namespace Microsoft.AspNet.Server.WebListener
requestContext = await _listener.GetContextAsync().SupressContext(); requestContext = await _listener.GetContextAsync().SupressContext();
} }
catch (Exception exception) catch (Exception exception)
{
Contract.Assert(_stopping);
if (_stopping)
{
LogHelper.LogVerbose(_logger, "ListenForNextRequestAsync-Stopping", exception);
}
else
{ {
LogHelper.LogException(_logger, "ListenForNextRequestAsync", exception); LogHelper.LogException(_logger, "ListenForNextRequestAsync", exception);
Contract.Assert(!_listener.IsListening); }
return; return;
} }
try try
@ -197,6 +204,7 @@ namespace Microsoft.AspNet.Server.WebListener
public void Dispose() public void Dispose()
{ {
LogHelper.LogInfo(_logger, "Stop");
_stopping = true; _stopping = true;
// Wait for active requests to drain // Wait for active requests to drain
if (_outstandingRequests > 0) if (_outstandingRequests > 0)