- Install the dotnet-trace tool
dotnet new tool-manifest
(If you want to install tools locally)dotnet tool install dotnet-trace (--global) (--version 3.0.0-*)
- List processes with
dotnet trace list-processes
- Start capturing for a process with
dotnet trace collect -p <<pid>> --providers Microsoft-Extensions-Logging -o <<outputpath>>.nettrace
- Open PerfView and navigate to the folder containing the ETL file.
- Double click on it.
- Go to events
- On the left column select Microsoft-Extensions_Logging/FormattedMessage
- Filter to the Process ID you care about
- On the columns to display add the following columns
LoggerName EventName FormattedMessage
Last active
September 12, 2019 17:35
-
-
Save javiercn/eefa37fd9e557bc69f5eb4273c95939c to your computer and use it in GitHub Desktop.
Logging options for capturing ASP.NET Core logs as ETW events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" standalone='yes'?> | |
<WindowsPerformanceRecorder Version="1.0"> | |
<Profiles> | |
<EventCollector | |
Id="AspNetCoreEventCollector" | |
Name="ASP.NET Core Event Collector"> | |
<BufferSize Value="4096"/> | |
<Buffers Value="256"/> | |
</EventCollector> | |
<EventProvider | |
Id="AspNetCore-provider" | |
Name="*Microsoft-Extensions-Logging" /> | |
<Profile | |
Id="AspNetCore_Logging.Verbose.File" | |
LoggingMode="File" | |
Name="AspNetCore_Logging" | |
DetailLevel="Verbose" | |
Description="Log events from ASP.NET Core"> | |
<Collectors> | |
<EventCollectorId Value="AspNetCoreEventCollector"> | |
<EventProviders> | |
<EventProviderId Value="AspNetCore-provider" /> | |
</EventProviders> | |
</EventCollectorId> | |
</Collectors> | |
</Profile> | |
<Profile | |
Id="AspNetCore_Logging.Verbose.Memory" | |
LoggingMode="Memory" | |
Name="AspNetCore_Logging" | |
DetailLevel="Verbose" | |
Description="Log events from ASP.NET Core" | |
Base="AspNetCore_Logging.Verbose.File"> | |
</Profile> | |
</Profiles> | |
</WindowsPerformanceRecorder> |
- Start collection with
wpr -start .\AspNetCore.wprp
(Requires admin priviledges) - End collection with
wpr -stop <<path>>.etl
- Open PerfView and navigate to the folder containing the ETL file.
- Double click on it.
- Go to events
- On the left column select Microsoft-Extensions_Logging/FormattedMessage
- Filter to the Process ID you care about
- On the columns to display add the following columns
LoggerName EventName FormattedMessage
Environment variables for setting up debug logging in ETW
$env:ASPNETCORE_Logging__EventSource__LogLevel__Default = "Debug";
$env:ASPNETCORE_Logging__EventSource__LogLevel__Microsoft = "Debug";
$env:ASPNETCORE_Logging__EventSource__IncludeScopes = "true";
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment