Microsoft.Extensions.Logging.TraceSource
                               
                            
                                10.0.0-rc.2.25502.107
                            
                        
                            
                                
                                
                                    Prefix Reserved
                                
                            
                    dotnet add package Microsoft.Extensions.Logging.TraceSource --version 10.0.0-rc.2.25502.107
NuGet\Install-Package Microsoft.Extensions.Logging.TraceSource -Version 10.0.0-rc.2.25502.107
<PackageReference Include="Microsoft.Extensions.Logging.TraceSource" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Logging.TraceSource" Version="10.0.0-rc.2.25502.107" />
<PackageReference Include="Microsoft.Extensions.Logging.TraceSource" />
paket add Microsoft.Extensions.Logging.TraceSource --version 10.0.0-rc.2.25502.107
#r "nuget: Microsoft.Extensions.Logging.TraceSource, 10.0.0-rc.2.25502.107"
#:package Microsoft.Extensions.Logging.TraceSource@10.0.0-rc.2.25502.107
#addin nuget:?package=Microsoft.Extensions.Logging.TraceSource&version=10.0.0-rc.2.25502.107&prerelease
#tool nuget:?package=Microsoft.Extensions.Logging.TraceSource&version=10.0.0-rc.2.25502.107&prerelease
About
Implements a trace logger provider for the .NET logging infrastructre facilitating enhanced logging capabilities and trace-level diagnostics in application by writing messages to a trace listener using System.Diagnostic.TraceSource.
Key Features
- Seamless integration with .NET logging infrastructure.
 - Fine-grained control over trace messages using SourceSwitch.
 - A set of builder methods to configure logging infrastructure.
 
How to Use
The Microsoft.Extensions.Logging.TraceSource library provides extension methods to the logger factory and the logger builder to add a trace source with trace listeners.
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using var consoleTraceListener = new ConsoleTraceListener();
using var textWriterTraceListener = new TextWriterTraceListener("/traces.txt");
using var loggerFactory = LoggerFactory.Create(builder =>
{
    builder
        .AddTraceSource(new SourceSwitch("Something") { Level = SourceLevels.All }, consoleTraceListener)
        .AddTraceSource(new SourceSwitch("HouseKeeping") { Level = SourceLevels.All }, textWriterTraceListener);
});
var logger = loggerFactory.CreateLogger<Program>();
logger.LogInformation("Information message.");
// Program Information: 0 : Information message.
logger.LogWarning("Warning message.");
// Program Warning: 0 : Warning message.
var traceSource = new TraceSource("HouseKeeping", SourceLevels.All);
traceSource.Listeners.Add(consoleTraceListener);
traceSource.Listeners.Add(textWriterTraceListener);
traceSource.TraceEvent(TraceEventType.Error, 0, "Error message.");
//HouseKeeping Error: 0 : Error message.
Main Types
The main types provided by this library are:
Microsoft.Extensions.Logging.TraceSource.TraceSourceLoggerProvider
Additional Documentation
Related Packages
- Abstractions for dependency injection: Microsoft.Extensions.DependencyInjection.Abstractions
 - Default implementation of logging infrastructure: Microsoft.Extensions.Logging
 - Abstractions for logging: Microsoft.Extensions.Logging.Abstractions
 
Feedback & Contributing
Microsoft.Extensions.Logging.TraceSource is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. | 
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. | 
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. | 
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. | 
| MonoAndroid | monoandroid was computed. | 
| MonoMac | monomac was computed. | 
| MonoTouch | monotouch was computed. | 
| Tizen | tizen40 was computed. tizen60 was computed. | 
| Xamarin.iOS | xamarinios was computed. | 
| Xamarin.Mac | xamarinmac was computed. | 
| Xamarin.TVOS | xamarintvos was computed. | 
| Xamarin.WatchOS | xamarinwatchos was computed. | 
- 
                                                    
.NETFramework 4.6.2
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 
 - 
                                                    
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 
 - 
                                                    
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 
 - 
                                                    
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 
 - 
                                                    
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 
 
NuGet packages (22)
Showing the top 5 NuGet packages that depend on Microsoft.Extensions.Logging.TraceSource:
| Package | Downloads | 
|---|---|
| 
                                                        
                                                            Microsoft.AspNetCore.App
                                                        
                                                            
                                                         Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.  | 
                                                    |
| 
                                                        
                                                            Microsoft.AspNetCore.All
                                                        
                                                            
                                                         Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.  | 
                                                    |
| 
                                                        
                                                            NCalc.Core
                                                        
                                                         Assembly with the core logic of NCalc.  | 
                                                    |
| 
                                                        
                                                            SuperOffice.NetServer.Core
                                                        
                                                            
                                                         SuperOffice NetServer Core is SuperOffice's data access technology for new applications. This is for onsite installations with the same version. This also works with SuperOffice Online.  | 
                                                    |
| 
                                                        
                                                            EasyNetQ-dotnet-core
                                                        
                                                         EasyNetQ  | 
                                                    
GitHub repositories (8)
Showing the top 8 popular GitHub repositories that depend on Microsoft.Extensions.Logging.TraceSource:
| Repository | Stars | 
|---|---|
| 
                                                        
                                                            mongodb/mongo-csharp-driver
                                                        
                                                         
                                                            The Official C# .NET Driver for MongoDB
                                                         
                                                     | 
                                                    |
| 
                                                        
                                                            ncalc/ncalc
                                                        
                                                         
                                                            NCalc is a fast and lightweight expression evaluator library for .NET, designed for flexibility and high performance. It supports a wide range of mathematical and logical operations.
                                                         
                                                     | 
                                                    |
| 
                                                        
                                                            Decimation/SmartImage
                                                        
                                                         
                                                            Reverse image search tool (SauceNao, IQDB, Ascii2D, trace.moe, and more)
                                                         
                                                     | 
                                                    |
| 
                                                        
                                                            ohadschn/letsencrypt-webapp-renewer
                                                        
                                                         
                                                            [PLEASE USE FREE MS MANAGED CERTS INSTEAD] Simple WebJob-ready console application for renewing Azure Web App SSL certificates
                                                         
                                                     | 
                                                    |
| 
                                                        
                                                            ProfessionalCSharp/MoreSamples
                                                        
                                                         
                                                            Additional code samples the book series Professional C#, Wrox Press
                                                         
                                                     | 
                                                    |
| 
                                                        
                                                            TurnerSoftware/InfinityCrawler
                                                        
                                                         
                                                            A simple but powerful web crawler library for .NET
                                                         
                                                     | 
                                                    |
| 
                                                        
                                                            witskeeper/geektime
                                                        
                                                         | 
                                                    |
| 
                                                        
                                                            jiangjinnan/InsideAspNet6
                                                        
                                                         | 
                                                    
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 10.0.0-rc.2.25502.107 | 222 | 10/14/2025 | |
| 10.0.0-rc.1.25451.107 | 243 | 9/9/2025 | |
| 10.0.0-preview.7.25380.108 | 252 | 8/12/2025 | |
| 10.0.0-preview.6.25358.103 | 210 | 7/15/2025 | |
| 10.0.0-preview.5.25277.114 | 271 | 6/6/2025 | |
| 10.0.0-preview.4.25258.110 | 370 | 5/12/2025 | |
| 10.0.0-preview.3.25171.5 | 336 | 4/10/2025 | |
| 10.0.0-preview.2.25163.2 | 318 | 3/18/2025 | |
| 10.0.0-preview.1.25080.5 | 318 | 2/25/2025 | |
| 9.0.10 | 1,812 | 10/14/2025 | |
| 9.0.9 | 4,326 | 9/9/2025 | |
| 9.0.8 | 4,859 | 8/4/2025 | |
| 9.0.7 | 103,375 | 7/8/2025 | |
| 9.0.6 | 4,476 | 6/10/2025 | |
| 9.0.5 | 29,985 | 5/13/2025 | |
| 9.0.4 | 136,210 | 4/8/2025 | |
| 9.0.3 | 5,858 | 3/11/2025 | |
| 9.0.2 | 127,597 | 2/11/2025 | |
| 9.0.1 | 5,325 | 1/14/2025 | |
| 9.0.0 | 141,417 | 11/12/2024 | |
| 9.0.0-rc.2.24473.5 | 377 | 10/8/2024 | |
| 9.0.0-rc.1.24431.7 | 344 | 9/10/2024 | |
| 9.0.0-preview.7.24405.7 | 475 | 8/13/2024 | |
| 9.0.0-preview.6.24327.7 | 362 | 7/9/2024 | |
| 9.0.0-preview.5.24306.7 | 324 | 6/11/2024 | |
| 9.0.0-preview.4.24266.19 | 318 | 5/21/2024 | |
| 9.0.0-preview.3.24172.9 | 399 | 4/11/2024 | |
| 9.0.0-preview.2.24128.5 | 455 | 3/12/2024 | |
| 9.0.0-preview.1.24080.9 | 776 | 2/13/2024 | |
| 8.0.1 | 212,669 | 10/8/2024 | |
| 8.0.0 | 1,013,309 | 11/14/2023 | |
| 8.0.0-rc.2.23479.6 | 755 | 10/10/2023 | |
| 8.0.0-rc.1.23419.4 | 771 | 9/12/2023 | |
| 8.0.0-preview.7.23375.6 | 1,361 | 8/8/2023 | |
| 8.0.0-preview.6.23329.7 | 719 | 7/11/2023 | |
| 8.0.0-preview.5.23280.8 | 986 | 6/13/2023 | |
| 8.0.0-preview.4.23259.5 | 613 | 5/16/2023 | |
| 8.0.0-preview.3.23174.8 | 538 | 4/11/2023 | |
| 8.0.0-preview.2.23128.3 | 772 | 3/14/2023 | |
| 8.0.0-preview.1.23110.8 | 784 | 2/21/2023 | |
| 7.0.0 | 178,676 | 11/7/2022 | |
| 7.0.0-rc.2.22472.3 | 456 | 10/11/2022 | |
| 7.0.0-rc.1.22426.10 | 510 | 9/14/2022 | |
| 7.0.0-preview.7.22375.6 | 516 | 8/9/2022 | |
| 7.0.0-preview.6.22324.4 | 471 | 7/12/2022 | |
| 7.0.0-preview.5.22301.12 | 1,009 | 6/14/2022 | |
| 7.0.0-preview.4.22229.4 | 741 | 5/10/2022 | |
| 7.0.0-preview.3.22175.4 | 526 | 4/13/2022 | |
| 7.0.0-preview.2.22152.2 | 533 | 3/14/2022 | |
| 7.0.0-preview.1.22076.8 | 560 | 2/17/2022 | |
| 6.0.1 | 1,690 | 11/12/2024 | |
| 6.0.0 | 1,759,227 | 11/8/2021 | |
| 6.0.0-rc.2.21480.5 | 598 | 10/12/2021 | |
| 6.0.0-rc.1.21451.13 | 564 | 9/14/2021 | |
| 6.0.0-preview.7.21377.19 | 814 | 8/10/2021 | |
| 6.0.0-preview.6.21352.12 | 598 | 7/14/2021 | |
| 6.0.0-preview.5.21301.5 | 557 | 6/15/2021 | |
| 6.0.0-preview.4.21253.7 | 550 | 5/24/2021 | |
| 6.0.0-preview.3.21201.4 | 1,701 | 4/8/2021 | |
| 6.0.0-preview.2.21154.6 | 707 | 3/11/2021 | |
| 6.0.0-preview.1.21102.12 | 692 | 2/12/2021 | |
| 5.0.0 | 1,302,801 | 11/9/2020 | |
| 5.0.0-rc.2.20475.5 | 803 | 10/13/2020 | |
| 5.0.0-rc.1.20451.14 | 890 | 9/14/2020 | |
| 5.0.0-preview.8.20407.11 | 777 | 8/25/2020 | |
| 5.0.0-preview.7.20364.11 | 809 | 7/21/2020 | |
| 5.0.0-preview.6.20305.6 | 927 | 6/25/2020 | |
| 5.0.0-preview.5.20278.1 | 787 | 6/10/2020 | |
| 5.0.0-preview.4.20251.6 | 956 | 5/18/2020 | |
| 5.0.0-preview.3.20215.2 | 878 | 4/23/2020 | |
| 5.0.0-preview.2.20160.3 | 879 | 4/2/2020 | |
| 5.0.0-preview.1.20120.4 | 898 | 3/16/2020 | |
| 3.1.32 | 5,646 | 12/13/2022 | |
| 3.1.31 | 6,426 | 11/8/2022 | |
| 3.1.30 | 3,789 | 10/11/2022 | |
| 3.1.29 | 3,764 | 9/13/2022 | |
| 3.1.28 | 6,875 | 8/9/2022 | |
| 3.1.27 | 3,863 | 7/12/2022 | |
| 3.1.26 | 3,792 | 6/14/2022 | |
| 3.1.25 | 3,763 | 5/10/2022 | |
| 3.1.24 | 4,254 | 4/11/2022 | |
| 3.1.23 | 3,881 | 3/8/2022 | |
| 3.1.22 | 14,495 | 12/14/2021 | |
| 3.1.21 | 4,279 | 11/7/2021 | |
| 3.1.20 | 4,810 | 10/11/2021 | |
| 3.1.19 | 4,192 | 9/14/2021 | |
| 3.1.18 | 7,280 | 8/10/2021 | |
| 3.1.17 | 8,523 | 7/13/2021 | |
| 3.1.16 | 6,179 | 6/8/2021 | |
| 3.1.15 | 4,073 | 5/11/2021 | |
| 3.1.14 | 4,878 | 4/6/2021 | |
| 3.1.13 | 5,099 | 3/9/2021 | |
| 3.1.12 | 51,135 | 2/9/2021 | |
| 3.1.11 | 7,838 | 1/12/2021 | |
| 3.1.10 | 576,322 | 11/9/2020 | |
| 3.1.9 | 125,226 | 10/13/2020 | |
| 3.1.8 | 60,091 | 9/8/2020 | |
| 3.1.7 | 60,896 | 8/11/2020 | |
| 3.1.6 | 267,624 | 7/14/2020 | |
| 3.1.5 | 25,312 | 6/9/2020 | |
| 3.1.4 | 28,190 | 5/12/2020 | |
| 3.1.3 | 65,196 | 3/24/2020 | |
| 3.1.2 | 883,419 | 2/18/2020 | |
| 3.1.1 | 370,716 | 1/14/2020 | |
| 3.1.0 | 17,663 | 12/3/2019 | |
| 3.1.0-preview3.19553.2 | 1,097 | 11/13/2019 | |
| 3.1.0-preview2.19525.4 | 828 | 11/1/2019 | |
| 3.1.0-preview1.19506.1 | 2,009 | 10/15/2019 | |
| 3.0.3 | 5,220 | 2/18/2020 | |
| 3.0.2 | 5,202 | 1/14/2020 | |
| 3.0.1 | 37,303 | 11/18/2019 | |
| 3.0.0 | 669,306 | 9/23/2019 | |
| 3.0.0-rc1.19456.10 | 930 | 9/16/2019 | |
| 3.0.0-preview9.19423.4 | 901 | 9/4/2019 | |
| 3.0.0-preview8.19405.4 | 933 | 8/13/2019 | |
| 3.0.0-preview7.19362.4 | 939 | 7/23/2019 | |
| 3.0.0-preview6.19304.6 | 2,578 | 6/12/2019 | |
| 3.0.0-preview5.19227.9 | 911 | 5/6/2019 | |
| 3.0.0-preview4.19216.2 | 877 | 4/18/2019 | |
| 3.0.0-preview3.19153.1 | 1,444 | 3/6/2019 | |
| 3.0.0-preview.19074.2 | 993 | 1/29/2019 | |
| 3.0.0-preview.18572.1 | 1,080 | 12/4/2018 | |
| 2.2.0 | 14,809,549 | 12/3/2018 | |
| 2.2.0-preview3-35497 | 66,612 | 10/17/2018 | |
| 2.2.0-preview2-35157 | 6,150 | 9/12/2018 | |
| 2.2.0-preview1-35029 | 3,471 | 8/22/2018 | |
| 2.1.1 | 17,236,683 | 6/18/2018 | |
| 2.1.0 | 3,621,922 | 5/29/2018 | |
| 2.1.0-rc1-final | 19,569 | 5/6/2018 | |
| 2.1.0-preview2-final | 20,091 | 4/10/2018 | |
| 2.1.0-preview1-final | 27,768 | 2/26/2018 | |
| 2.0.2 | 3,798,798 | 5/7/2018 | |
| 2.0.1 | 3,473,819 | 3/13/2018 | |
| 2.0.0 | 9,770,507 | 8/11/2017 | |
| 2.0.0-preview2-final | 52,188 | 6/28/2017 | |
| 2.0.0-preview1-final | 17,194 | 5/10/2017 | |
| 1.1.2 | 96,817 | 5/9/2017 | |
| 1.1.1 | 90,422 | 3/6/2017 | |
| 1.1.0 | 74,356 | 11/16/2016 | |
| 1.1.0-preview1-final | 3,672 | 10/24/2016 | |
| 1.0.2 | 3,583,345 | 3/6/2017 | |
| 1.0.1 | 5,244 | 12/12/2016 | |
| 1.0.0 | 237,265 | 6/27/2016 | |
| 1.0.0-rc2-final | 3,493 | 5/16/2016 | |
| 1.0.0-rc1-final | 10,004 | 11/18/2015 |