@@ -32,6 +32,7 @@ internal static class MvcCoreLoggerExtensions
32
32
private static readonly double TimestampToTicks = TimeSpan . TicksPerSecond / ( double ) Stopwatch . Frequency ;
33
33
34
34
private static readonly Action < ILogger , string , string , Exception > _actionExecuting ;
35
+ private static readonly Action < ILogger , string , MethodInfo , string , string , Exception > _controllerActionExecuting ;
35
36
private static readonly Action < ILogger , string , double , Exception > _actionExecuted ;
36
37
37
38
private static readonly Action < ILogger , string [ ] , Exception > _challengeResultExecuting ;
@@ -153,6 +154,11 @@ static MvcCoreLoggerExtensions()
153
154
1 ,
154
155
"Route matched with {RouteData}. Executing action {ActionName}" ) ;
155
156
157
+ _controllerActionExecuting = LoggerMessage . Define < string , MethodInfo , string , string > (
158
+ LogLevel . Information ,
159
+ 3 ,
160
+ "Route matched with {RouteData}. Executing controller action with signature {MethodInfo} on controller {Controller} ({AssemblyName})." ) ;
161
+
156
162
_actionExecuted = LoggerMessage . Define < string , double > (
157
163
LogLevel . Information ,
158
164
2 ,
@@ -683,7 +689,22 @@ public static void ExecutingAction(this ILogger logger, ActionDescriptor action)
683
689
}
684
690
}
685
691
686
- _actionExecuting ( logger , stringBuilder . ToString ( ) , action . DisplayName , null ) ;
692
+ if ( action is ControllerActionDescriptor controllerActionDescriptor )
693
+ {
694
+ var controllerType = controllerActionDescriptor . ControllerTypeInfo . AsType ( ) ;
695
+ var controllerName = TypeNameHelper . GetTypeDisplayName ( controllerType ) ;
696
+ _controllerActionExecuting (
697
+ logger ,
698
+ stringBuilder . ToString ( ) ,
699
+ controllerActionDescriptor . MethodInfo ,
700
+ controllerName ,
701
+ controllerType . Assembly . GetName ( ) . Name ,
702
+ null ) ;
703
+ }
704
+ else
705
+ {
706
+ _actionExecuting ( logger , stringBuilder . ToString ( ) , action . DisplayName , null ) ;
707
+ }
687
708
}
688
709
}
689
710
0 commit comments