[Fixes #4575] Logging ArgumentOutOfRangeException

This commit is contained in:
Kiran Challa 2016-05-02 10:59:20 -07:00
parent 7b2fdcbfec
commit ad065892fd
2 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
private static readonly Action<ILogger, string, Exception> _noFormatter; private static readonly Action<ILogger, string, Exception> _noFormatter;
private static readonly Action<ILogger, IOutputFormatter, string, Exception> _formatterSelected; private static readonly Action<ILogger, IOutputFormatter, string, Exception> _formatterSelected;
private static readonly Action<ILogger, string, Exception> _skippedContentNegotiation; private static readonly Action<ILogger, string, Exception> _skippedContentNegotiation;
private static readonly Action<ILogger, string, Exception> _noAcceptForNegotiation; private static readonly Action<ILogger, Exception> _noAcceptForNegotiation;
private static readonly Action<ILogger, IEnumerable<MediaTypeSegmentWithQuality>, Exception> _noFormatterFromNegotiation; private static readonly Action<ILogger, IEnumerable<MediaTypeSegmentWithQuality>, Exception> _noFormatterFromNegotiation;
private static readonly Action<ILogger, string, Exception> _redirectResultExecuting; private static readonly Action<ILogger, string, Exception> _redirectResultExecuting;
@ -174,7 +174,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
3, 3,
"Skipped content negotiation as content type '{ContentType}' is explicitly set for the response."); "Skipped content negotiation as content type '{ContentType}' is explicitly set for the response.");
_noAcceptForNegotiation = LoggerMessage.Define<string>( _noAcceptForNegotiation = LoggerMessage.Define(
LogLevel.Debug, LogLevel.Debug,
4, 4,
"No information found on request to perform content negotiation."); "No information found on request to perform content negotiation.");
@ -369,7 +369,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
public static void NoAcceptForNegotiation(this ILogger logger) public static void NoAcceptForNegotiation(this ILogger logger)
{ {
_noAcceptForNegotiation(logger, null, null); _noAcceptForNegotiation(logger, null);
} }
public static void NoFormatterFromNegotiation(this ILogger logger, IList<MediaTypeSegmentWithQuality> acceptTypes) public static void NoFormatterFromNegotiation(this ILogger logger, IList<MediaTypeSegmentWithQuality> acceptTypes)

View File

@ -8,13 +8,13 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
{ {
internal static class MvcJsonLoggerExtensions internal static class MvcJsonLoggerExtensions
{ {
private static readonly Action<ILogger, string, Exception> _jsonInputFormatterCrashed; private static readonly Action<ILogger, Exception> _jsonInputFormatterCrashed;
private static readonly Action<ILogger, string, Exception> _jsonResultExecuting; private static readonly Action<ILogger, string, Exception> _jsonResultExecuting;
static MvcJsonLoggerExtensions() static MvcJsonLoggerExtensions()
{ {
_jsonInputFormatterCrashed = LoggerMessage.Define<string>( _jsonInputFormatterCrashed = LoggerMessage.Define(
LogLevel.Debug, LogLevel.Debug,
1, 1,
"JSON input formatter threw an exception."); "JSON input formatter threw an exception.");
@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
public static void JsonInputException(this ILogger logger, Exception exception) public static void JsonInputException(this ILogger logger, Exception exception)
{ {
_jsonInputFormatterCrashed(logger, exception.ToString(), exception); _jsonInputFormatterCrashed(logger, exception);
} }
public static void JsonResultExecuting(this ILogger logger, object value) public static void JsonResultExecuting(this ILogger logger, object value)