Home
%3CLINGO-SUB%20id%3D%22lingo-sub-342696%22%20slang%3D%22en-US%22%3ECapturing%20Perfview%20traces%20for%20ASPNET%20Core%20application%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-342696%22%20slang%3D%22en-US%22%3E%3CP%3ERecently%2C%20I%20worked%20with%20one%20of%20the%20customer%20who%20wanted%20assistance%20in%20implementing%20the%20logging%20and%20capturing%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D28567%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Eperfview%3C%2FA%3E%20traces%20for%20aspnet%20core%20web%20application.%3C%2FP%3E%0A%3CP%3ESo%2C%20I%20decided%20to%20blog%20on%20this%20topic%20and%20explain%20how%20to%20enable%20the%20logging%2C%20capture%20and%20analyze%20perfview%20trace.%3C%2FP%3E%0A%3CP%3EI%20am%20making%20use%20of%20a%20simple%20ASPNET%20Core%20MVC%20application%20here%20to%20explain%20this.%3C%2FP%3E%0A%3CP%3EI%20have%20the%20below%20lines%20in%20my%20%3CSTRONG%3EProgram.cs%20%3C%2FSTRONG%3Efile%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20style%3D%22border-collapse%3A%20collapse%3B%22%20border%3D%220%22%3E%3CCOLGROUP%3E%3CCOL%20style%3D%22width%3A%20848px%3B%22%20%2F%3E%3C%2FCOLGROUP%3E%0A%3CTBODY%20valign%3D%22top%22%3E%0A%3CTR%20style%3D%22height%3A%20188px%3B%22%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border%3A%20solid%200.5pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3Estatic%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3Evoid%20Main(string%5B%5D%20args)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%209pt%3B%22%3E%7B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20BuildWebHost(args).Run()%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%7D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%209pt%3B%22%3Epublic%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3Estatic%20IWebHost%20BuildWebHost(string%5B%5D%20args)%20%3D%26gt%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20WebHost.CreateDefaultBuilder(args)%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20.CaptureStartupErrors(%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3Etrue%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E)%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20green%3B%22%3E%2F%2F%20THE%20ABOVE%20LINE%20IS%20FOR%20THE%20STARTUP%20RELATED%20ISSUES%20%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20.UseSetting(WebHostDefaults.DetailedErrorsKey%2C%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22true%22%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E)%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20green%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20%2F%2FTHE%20ABOVE%20LINE%20WILL%20GIVE%20A%20DETAILED%20ERROR%20PAGE%20IN%20CASE%20OF%20ANY%20FAILURE%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20.UseStartup%3CSTARTUP%3E()%3CBR%20%2F%3E%3C%2FSTARTUP%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20.UseKestrel()%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20.ConfigureLogging((hostingContext%2Clogging)%3D%26gt%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20%7B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Blogging.AddConfiguration(hostingContext.Configuration.GetSection(%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22Logging%22%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E))%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Blogging.AddConsole()%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20green%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%2F%2FTHE%20ABOVE%20LINE%20WILL%20DISPLAY%20THE%20LOGS%20IN%20CONSOLE%20WHILE%20RUNNING%20THE%20APP%20FROM%20THE%20CMD%20LINE%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Blogging.AddDebug()%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20green%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%2F%2FTHE%20ABOVE%20LINE%20WILL%20DISPLAY%20THE%20LOGS%20IN%20DEBUG%20OUTPUT%20WINDOW%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Blogging.AddEventSourceLogger()%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20green%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%2F%2F%3CSTRONG%3ETHE%20ABOVE%20LINE%20IS%20FOR%20THE%20PERFVIEW%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20green%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-size%3A%209pt%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20green%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-size%3A%209pt%3B%22%3E)%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%20.Build()%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnsure%20that%20you%20have%20placed%20the%20below%20namespaces%20within%20your%20Program.cs%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%2010pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Busing%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%20Microsoft.AspNetCore.Hosting%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%2010pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Busing%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%20Microsoft.Extensions.Logging%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%2010pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Busing%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%20Microsoft.AspNetCore%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EYou%20can%20make%20use%20of%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMicrosoft.Extensions.Logging%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSTRONG%3ENuget%3C%2FSTRONG%3E%3C%2FA%3E%20PM%20to%20install%20the%20%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Consolas%3B%20font-size%3A%209pt%3B%22%3E%3CSTRONG%3EMicrosoft.Extensions.Logging%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3Ecomponent.%3C%2FP%3E%0A%3CP%3EGo%20to%20your%20%3CSTRONG%3Econcerned%3C%2FSTRONG%3E%20Controller%20and%20ensure%20that%20you%20have%20referenced%20the%20logging%20component%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20style%3D%22border-collapse%3A%20collapse%3B%22%20border%3D%220%22%3E%3CCOLGROUP%3E%3CCOL%20style%3D%22width%3A%20833px%3B%22%20%2F%3E%3C%2FCOLGROUP%3E%0A%3CTBODY%20valign%3D%22top%22%3E%0A%3CTR%20style%3D%22height%3A%20167px%3B%22%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border%3A%20solid%200.5pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3Epublic%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3Eclass%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20%232b91af%3B%22%3EHomeController%20%3A%20Controller%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%7B%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20green%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20GET%3A%20%2F%3CCONTROLLER%3E%2F%3C%2FCONTROLLER%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20private%26nbsp%3B%3CSPAN%20style%3D%22color%3A%20black%3B%22%3Ereadonly%20ILogger%20_logger%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20public%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%20HomeController(ILogger%3CHOMECONTROLLER%3E%20logger)%3C%2FHOMECONTROLLER%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%7B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B_logger%20%3D%20logger%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20public%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%20IActionResult%20Index()%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%7B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20green%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%2F%2F%20This%20code%20specifies%20the%20loglevel.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20green%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%2F%2F%20Ex%3A%20LogInformation%2C%20LogWarning%2C%20LogCritical%2C%20LogDebug%20etc%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B_logger.LogInformation(1000%2C%20%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22In%20Index%20method..............%22%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E)%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Breturn%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%20View()%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20black%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%7D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnsure%20that%20you%20have%20placed%20the%20below%20namespaces%20within%20your%20Controller%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%20font-family%3A%20Courier%20New%3B%20font-size%3A%2010pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Busing%3CSPAN%20style%3D%22color%3A%20black%3B%22%3E%20Microsoft.AspNetCore.Mvc%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22color%3A%20blue%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%2010pt%3B%22%3E%26nbsp%3B%20%26nbsp%3Busing%20Microsoft.Extensions.Logging%3B%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Consolas%3B%20font-size%3A%209pt%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20doing%20the%20above%20changes%2C%20you%20will%20see%20the%20Logging%20information%20within%20your%20%3CSTRONG%3EDebug%20Output%3C%2FSTRONG%3E%20window%20and%20the%20%3CSTRONG%3ECMD%20%3C%2FSTRONG%3Econsole.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3E%3CSTRONG%3EIn%20the%20Debug%20window%3A%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20style%3D%22border-collapse%3A%20collapse%3B%22%20border%3D%220%22%3E%3CCOLGROUP%3E%3CCOL%20style%3D%22width%3A%20828px%3B%22%20%2F%3E%3C%2FCOLGROUP%3E%0A%3CTBODY%20valign%3D%22top%22%3E%0A%3CTR%20style%3D%22height%3A%2087px%3B%22%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border%3A%20solid%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3EMicrosoft.AspNetCore.Hosting.Internal.WebHost%3AInformation%3A%20Request%20starting%20HTTP%2F1.1%20GET%20http%3A%2F%2Flocalhost%3A5761%2Fhome%2Findex%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3EMicrosoft.AspNetCore.Hosting.Internal.WebHost%3AInformation%3A%20Request%20starting%20HTTP%2F1.1%20GET%20http%3A%2F%2Flocalhost%3A5761%2Fhome%2Findex%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E------------------------------------%3C%2FSPAN%3E%3CBR%20%2F%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3EDemo.Controllers.HomeController%3AInformation%3A%20%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3EIn%20Index%20method..............%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3EDemo.Controllers.HomeController%3AInformation%3A%20%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3EIn%20Index%20method..............%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3E%3CSTRONG%3EIn%20the%20CMD%20console%3A%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20style%3D%22border-collapse%3A%20collapse%3B%22%20border%3D%220%22%3E%3CCOLGROUP%3E%3CCOL%20style%3D%22width%3A%20822px%3B%22%20%2F%3E%3C%2FCOLGROUP%3E%0A%3CTBODY%20valign%3D%22top%22%3E%0A%3CTR%20style%3D%22height%3A%2097px%3B%22%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border%3A%20solid%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Hosting.Internal.WebHost%5B1%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Request%20starting%20HTTP%2F1.1%20GET%20http%3A%2F%2Flocalhost%3A5762%2Fhome%2Findex%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Hosting.Internal.WebHost%5B1%5D%3C%2FSPAN%3E%3CBR%20%2F%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Request%20starting%20HTTP%2F1.1%20GET%20http%3A%2F%2Flocalhost%3A5762%2Fhome%2Findex%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker%5B1%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Executing%20action%20method%20Demo.Controllers.HomeController.Index%20(Demo)%20with%20arguments%20((null))%20-%20ModelState%20is%20Valid%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker%5B1%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Executing%20action%20method%20Demo.Controllers.HomeController.Index%20(Demo)%20with%20arguments%20((null))%20-%20ModelState%20is%20Valid%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfoinfo%3A%20Demo.Controllers.HomeController%5B1000%5D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%208pt%3B%22%3EIn%20Index%20method..............%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%3A%20Demo.Controllers.HomeController%5B1000%5D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%208pt%3B%22%3EIn%20Index%20method..............%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor%5B1%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Executing%20ViewResult%2C%20running%20view%20at%20path%20%2FViews%2FHome%2FIndex.cshtml.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor%5B1%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Executing%20ViewResult%2C%20running%20view%20at%20path%20%2FViews%2FHome%2FIndex.cshtml.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker%5B2%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Executed%20action%20Demo.Controllers.HomeController.Index%20(Demo)%20in%204628.1449ms%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker%5B2%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Executed%20action%20Demo.Controllers.HomeController.Index%20(Demo)%20in%204628.1449ms%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Hosting.Internal.WebHost%5B2%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Request%20finished%20in%204686.3757ms%20200%20text%2Fhtml%3B%20charset%3Dutf-8%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3Einfo%3A%20Microsoft.AspNetCore.Hosting.Internal.WebHost%5B2%5D%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%208pt%3B%22%3E%20Request%20finished%20in%204686.3757ms%20200%20text%2Fhtml%3B%20charset%3Dutf-8%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3E%3CSTRONG%3EPerfview%20Data%20Collection%3A%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EDownload%20the%20Perfview%20from%20the%20below%20location%20and%20place%20it%20on%20the%20machine%20where%20you%20have%20the%20ASPNET%20Core%20app%20running%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D28567%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D28567%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3E%3CSTRONG%3E%3CEM%3EData%20Capture%3A%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EOpen%20%3CSTRONG%3EPerfview%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3EGo%20to%20%3CSTRONG%3ECollect%3C%2FSTRONG%3E%20and%20select%20%3CSTRONG%3ECollect%3C%2FSTRONG%3E%20option%20as%20shown%20below%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CIMG%20class%3D%22aligncenter%22%20alt%3D%22%22%20src%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2F2017%2F12%2F122717_1733_CapturingPe1.png%22%20border%3D%220%22%20%2F%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EExpand%20the%20%3CSTRONG%3EAdvanced%20Options%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3EEnable%20the%20%3CSTRONG%3EThread%20Time%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EIIS%20%3C%2FSTRONG%3Eproviders.%20(This%20will%20help%20us%20give%20some%20additional%20Information%20while%20troubleshooting)%20%3CSPAN%20style%3D%22font-size%3A%209pt%3B%22%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20IIS%20provider%20is%20needed%20if%20the%20app%20is%20hosted%20on%20IIS.%20Else%20you%20can%20skip%20it.%20This%20provider%20can%20be%20used%20only%20if%20the%20IIS%20%3CSTRONG%3ETracing%3C%2FSTRONG%3E%20feature%20is%20installed.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EPlace%20the%20%3CSTRONG%3E*Microsoft-Extensions-Logging%20%3C%2FSTRONG%3Esection%20within%20%3CSTRONG%3EAdditional%20Providers%3C%2FSTRONG%3E%20section%20as%20shown%20below%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CIMG%20class%3D%22aligncenter%22%20alt%3D%22%22%20src%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2F2017%2F12%2F122717_1733_CapturingPe2.png%22%20border%3D%220%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3E%3CSTRONG%3EPerfview%20Analysis%3A%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20we%20open%20the%20perfview%20ETL%20trace%20we%20see%20our%20logging%20information%20being%20logged%3A%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20style%3D%22border-collapse%3A%20collapse%3B%22%20border%3D%220%22%3E%3CCOLGROUP%3E%3CCOL%20style%3D%22width%3A%20205px%3B%22%20%2F%3E%3CCOL%20style%3D%22width%3A%2086px%3B%22%20%2F%3E%3CCOL%20style%3D%22width%3A%2078px%3B%22%20%2F%3E%3CCOL%20style%3D%22width%3A%20458px%3B%22%20%2F%3E%3C%2FCOLGROUP%3E%0A%3CTBODY%20valign%3D%22top%22%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20solid%20%23999999%200.5pt%3B%20border-left%3A%20solid%20%23999999%200.5pt%3B%20border-bottom%3A%20solid%20%23666666%201.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3EEvent%20Name%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20solid%20%23999999%200.5pt%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23666666%201.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3ETime%20MSec%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20solid%20%23999999%200.5pt%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23666666%201.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3EProcess%20Name%20%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20solid%20%23999999%200.5pt%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23666666%201.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Times%20New%20Roman%3B%20font-size%3A%2012pt%3B%22%3E%3CSTRONG%3ERest%20%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20solid%20%23999999%200.5pt%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSTRONG%3EMicrosoft-Extensions-Logging%2FFormattedMessage%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E39%2C706.201%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3Edotnet%20(25292)%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3EThreadID%3D%22285%2C016%22%20Level%3D%222%22%20FactoryID%3D%221%22%20LoggerName%3D%22Demo.Controllers.HomeController%22%20EventId%3D%221000%22%20FormattedMessage%3D%22%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3EIn%20Index%20method..............%3C%2FSPAN%3E%22%20ActivityID%3D%22%2F%2F1%2F3%2F1%2F%22%20%3C%2FSPAN%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20solid%20%23999999%200.5pt%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSTRONG%3EMicrosoft-Extensions-Logging%2FMessage%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E39%2C708.668%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3Edotnet%20(25292)%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3EThreadID%3D%22285%2C016%22%20Level%3D%222%22%20FactoryID%3D%221%22%20LoggerName%3D%22Demo.Controllers.HomeController%22%20EventId%3D%221000%22%20Exception%3D%22%7B%20TypeName%3D%22%22%2C%20Message%3D%22%22%2C%20HResult%3D0%2C%20VerboseMessage%3D%22%22%20%7D%22%20Arguments%3D%22%5B%7B%20Key%3D%22%7BOriginalFormat%7D%22%2C%20Value%3D%22%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3EIn%20Index%20method..............%3C%2FSPAN%3E%22%20%7D%5D%22%20ActivityID%3D%22%2F%2F1%2F3%2F1%2F%22%20%3C%2FSPAN%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20solid%20%23999999%200.5pt%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%3CSTRONG%3EMicrosoft-Extensions-Logging%2FMessageJson%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E39%2C708.700%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3Edotnet%20(25292)%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%20style%3D%22padding-left%3A%207px%3B%20padding-right%3A%207px%3B%20border-top%3A%20none%3B%20border-left%3A%20none%3B%20border-bottom%3A%20solid%20%23999999%200.5pt%3B%20border-right%3A%20solid%20%23999999%200.5pt%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3EThreadID%3D%22285%2C016%22%20Level%3D%222%22%20FactoryID%3D%221%22%20LoggerName%3D%22Demo.Controllers.HomeController%22%20EventId%3D%221000%22%20ExceptionJson%3D%22%7B%7D%22%20ArgumentsJson%3D%22%7B%22%7BOriginalFormat%7D%22%3A%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Courier%20New%3B%20font-size%3A%209pt%3B%22%3E%22%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3EIn%20Index%20method..............%3C%2FSPAN%3E%22%7D%22%20ActivityID%3D%22%2F%2F1%2F3%2F1%2F%22%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHope%20this%20helps%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EAuthor%3A%20Naveen%20Baliga%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E

Recently, I worked with one of the customer who wanted assistance in implementing the logging and capturing the perfview traces for aspnet core web application.

So, I decided to blog on this topic and explain how to enable the logging, capture and analyze perfview trace.

I am making use of a simple ASPNET Core MVC application here to explain this.

I have the below lines in my Program.cs file:

 

static void Main(string[] args)

 

{

    BuildWebHost(args).Run();

}

public static IWebHost BuildWebHost(string[] args) =>

WebHost.CreateDefaultBuilder(args)

.CaptureStartupErrors(true)

// THE ABOVE LINE IS FOR THE STARTUP RELATED ISSUES

.UseSetting(WebHostDefaults.DetailedErrorsKey,"true")

//THE ABOVE LINE WILL GIVE A DETAILED ERROR PAGE IN CASE OF ANY FAILURE

.UseStartup<Startup>()

.UseKestrel()

.ConfigureLogging((hostingContext,logging)=>

{

   logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));

   logging.AddConsole();

   //THE ABOVE LINE WILL DISPLAY THE LOGS IN CONSOLE WHILE RUNNING THE APP FROM THE CMD LINE

   logging.AddDebug();

   //THE ABOVE LINE WILL DISPLAY THE LOGS IN DEBUG OUTPUT WINDOW

   logging.AddEventSourceLogger();

   //THE ABOVE LINE IS FOR THE PERFVIEW

})

.Build();

 

Ensure that you have placed the below namespaces within your Program.cs

   using Microsoft.AspNetCore.Hosting;

   using Microsoft.Extensions.Logging;

   using Microsoft.AspNetCore;

You can make use of the Nuget PM to install the Microsoft.Extensions.Logging component.

Go to your concerned Controller and ensure that you have referenced the logging component

public class HomeController : Controller
{
    // GET: /<controller>/

 

    private readonly ILogger _logger;

    public HomeController(ILogger<HomeController> logger)

    {

       _logger = logger;

    }

    public IActionResult Index()

    {

       // This code specifies the loglevel.

       // Ex: LogInformation, LogWarning, LogCritical, LogDebug etc

       _logger.LogInformation(1000, "In Index method..............");

       return View();

    }

}

 

Ensure that you have placed the below namespaces within your Controller:

   using Microsoft.AspNetCore.Mvc;

   using Microsoft.Extensions.Logging;

After doing the above changes, you will see the Logging information within your Debug Output window and the CMD console.

 

In the Debug window:

Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:5761/home/index
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:5761/home/index
------------------------------------

 

Demo.Controllers.HomeController:Information: In Index method..............

Demo.Controllers.HomeController:Information: In Index method..............

 

In the CMD console:

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5762/home/index
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]

 

Request starting HTTP/1.1 GET http://localhost:5762/home/index

info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]

Executing action method Demo.Controllers.HomeController.Index (Demo) with arguments ((null)) - ModelState is Valid

info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]

Executing action method Demo.Controllers.HomeController.Index (Demo) with arguments ((null)) - ModelState is Valid

infoinfo: Demo.Controllers.HomeController[1000] In Index method..............

: Demo.Controllers.HomeController[1000] In Index method..............

info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]

Executing ViewResult, running view at path /Views/Home/Index.cshtml.

info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]

Executing ViewResult, running view at path /Views/Home/Index.cshtml.

info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]

Executed action Demo.Controllers.HomeController.Index (Demo) in 4628.1449ms

info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]

Executed action Demo.Controllers.HomeController.Index (Demo) in 4628.1449ms

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]

Request finished in 4686.3757ms 200 text/html; charset=utf-8

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]

Request finished in 4686.3757ms 200 text/html; charset=utf-8

 

Perfview Data Collection:

Download the Perfview from the below location and place it on the machine where you have the ASPNET Core app running:

https://www.microsoft.com/en-us/download/details.aspx?id=28567

Data Capture:

  • Open Perfview.
  • Go to Collect and select Collect option as shown below:

  • Expand the Advanced Options.
  • Enable the Thread Time and IIS providers. (This will help us give some additional Information while troubleshooting) Note: IIS provider is needed if the app is hosted on IIS. Else you can skip it. This provider can be used only if the IIS Tracing feature is installed.
  • Place the *Microsoft-Extensions-Logging section within Additional Providers section as shown below:

 

Perfview Analysis:

After we open the perfview ETL trace we see our logging information being logged:

Event Name                                    Time MSec Process Name   Rest  
Microsoft-Extensions-Logging/FormattedMessage 39,706.201 dotnet (25292) ThreadID="285,016" Level="2" FactoryID="1" LoggerName="Demo.Controllers.HomeController" EventId="1000" FormattedMessage="In Index method.............." ActivityID="//1/3/1/"
Microsoft-Extensions-Logging/Message          39,708.668 dotnet (25292) ThreadID="285,016" Level="2" FactoryID="1" LoggerName="Demo.Controllers.HomeController" EventId="1000" Exception="{ TypeName="", Message="", HResult=0, VerboseMessage="" }" Arguments="[{ Key="{OriginalFormat}", Value="In Index method.............." }]" ActivityID="//1/3/1/"
Microsoft-Extensions-Logging/MessageJson      39,708.700 dotnet (25292) ThreadID="285,016" Level="2" FactoryID="1" LoggerName="Demo.Controllers.HomeController" EventId="1000" ExceptionJson="{}" ArgumentsJson="{"{OriginalFormat}":

 

"In Index method.............."}" ActivityID="//1/3/1/"

 

Hope this helps :)

 

Author: Naveen Baliga