@@ -900,14 +900,10 @@ await RunAsync<TestStartup>(
900900 services => services
901901 . AddLogging ( builder =>
902902 {
903- // enable Microsoft.AspNetCore.Routing.Matching.DfaMatcher debug logs
904- // which are produced by ASP.NET Core within HTTP context.
905- // This is what is going to be buffered and tested.
906- builder . AddFilter ( "Microsoft.AspNetCore.Routing.Matching.DfaMatcher" , LogLevel . Debug ) ;
907-
908- // Disable logs from HTTP logging middleware, otherwise even though they are not buffered,
909- // they will be logged as usual and contaminate test results:
910- builder . AddFilter ( "Microsoft.AspNetCore.HttpLogging" , LogLevel . None ) ;
903+ // Disable logs from all ASP.NET Core infrastructure, otherwise they
904+ // will contaminate test results:
905+ builder . AddFilter ( "Microsoft.AspNetCore" , LogLevel . None ) ;
906+ builder . AddFilter ( "Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware" , LogLevel . None ) ;
911907
912908 builder . AddPerIncomingRequestBuffer ( options =>
913909 {
@@ -944,10 +940,10 @@ await RunAsync<TestStartup>(
944940 logger . LogTrace ( $ "This is a huge log message 3, { hugeState } ") ;
945941 await WaitForLogRecordsAsync ( logCollector , _defaultLogTimeout ) ;
946942
947- // 1st log record is from DfaMatcher,
948- // 2, 3, 4th are from our "test" category
949- // and 5 and 6th are logs from the /logatrequest endpoint
950- Assert . Equal ( 6 , logCollector . Count ) ;
943+ // 1st is the flushed Trace from "test" category
944+ // 2nd and 3rd are logs emitted by the /logatrequest endpoint
945+ // and 4th and 5th are unbuffered logs from our "test" category
946+ Assert . Equal ( 5 , logCollector . Count ) ;
951947 Assert . Equal ( LogLevel . Trace , logCollector . LatestRecord . Level ) ;
952948 Assert . Equal ( "test" , logCollector . LatestRecord . Category ) ;
953949 } ) ;
0 commit comments