Microsoft.Extensions.Logging.TraceSource 11.0.0-preview.6.26359.118

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

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.

Showing the top 20 packages that depend on Microsoft.Extensions.Logging.TraceSource.

Packages Downloads
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
138
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
139
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
141
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
142
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.
137
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.
138
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.
141
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.
142
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.
144
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.
145
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.
147
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.
148
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.
150
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.
153
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.
156
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. This package was built from the source at: https://github.com/aspnet/Universe/tree/1016eae4004686f7fdad13f5c329f63bbae1f3a1
144

https://go.microsoft.com/fwlink/?LinkID=799421

.NET 10.0

.NET 11.0

.NET Framework 4.6.2

.NET Standard 2.0

Version Downloads Last updated
11.0.0-preview.6.26359.118 4 07/18/2026
11.0.0-preview.5.26302.115 14 06/10/2026
11.0.0-preview.4.26230.115 24 05/13/2026
11.0.0-preview.3.26207.106 36 04/14/2026
11.0.0-preview.2.26159.112 36 03/10/2026
11.0.0-preview.1.26104.118 40 02/12/2026
10.0.10 5 07/17/2026
10.0.9 13 06/10/2026
10.0.8 19 05/13/2026
10.0.7 27 04/21/2026
10.0.6 32 04/14/2026
10.0.5 33 03/13/2026
10.0.4 30 03/11/2026
10.0.3 37 02/12/2026
10.0.2 42 01/14/2026
10.0.1 62 12/11/2025
10.0.0 69 11/13/2025
10.0.0-rc.2.25502.107 90 10/15/2025
10.0.0-rc.1.25451.107 89 09/10/2025
10.0.0-preview.7.25380.108 82 08/14/2025
10.0.0-preview.6.25358.103 102 07/16/2025
10.0.0-preview.5.25277.114 96 06/07/2025
10.0.0-preview.4.25258.110 103 05/16/2025
10.0.0-preview.3.25171.5 108 04/12/2025
10.0.0-preview.2.25163.2 121 04/02/2025
10.0.0-preview.1.25080.5 110 04/02/2025
9.0.18 5 07/18/2026
9.0.17 12 06/10/2026
9.0.16 18 05/13/2026
9.0.15 29 04/14/2026
9.0.14 32 03/11/2026
9.0.13 36 02/12/2026
9.0.12 39 01/13/2026
9.0.11 91 11/14/2025
9.0.10 86 10/15/2025
9.0.9 102 09/10/2025
9.0.8 88 08/05/2025
9.0.7 95 07/09/2025
9.0.6 99 06/12/2025
9.0.5 90 05/18/2025
9.0.4 110 04/10/2025
9.0.3 140 03/29/2025
9.0.2 140 03/29/2025
9.0.1 115 03/29/2025
9.0.0 105 11/14/2024
9.0.0-rc.2.24473.5 105 10/19/2024
9.0.0-rc.1.24431.7 108 10/20/2024
9.0.0-preview.7.24405.7 120 08/28/2024
9.0.0-preview.6.24327.7 130 07/20/2024
9.0.0-preview.5.24306.7 132 07/20/2024
9.0.0-preview.4.24266.19 120 07/20/2024
9.0.0-preview.3.24172.9 132 07/20/2024
9.0.0-preview.2.24128.5 133 07/20/2024
9.0.0-preview.1.24080.9 148 07/20/2024
8.0.1 99 10/18/2024
8.0.0 130 07/20/2024
8.0.0-rc.2.23479.6 164 07/20/2024
8.0.0-rc.1.23419.4 162 07/20/2024
8.0.0-preview.7.23375.6 129 07/20/2024
8.0.0-preview.6.23329.7 156 07/20/2024
8.0.0-preview.5.23280.8 128 07/20/2024
8.0.0-preview.4.23259.5 142 07/20/2024
8.0.0-preview.3.23174.8 146 07/20/2024
8.0.0-preview.2.23128.3 143 07/20/2024
8.0.0-preview.1.23110.8 137 07/20/2024
7.0.0 148 07/20/2024
7.0.0-rc.2.22472.3 137 07/20/2024
7.0.0-rc.1.22426.10 131 07/20/2024
7.0.0-preview.7.22375.6 142 07/20/2024
7.0.0-preview.6.22324.4 126 07/20/2024
7.0.0-preview.5.22301.12 132 07/20/2024
7.0.0-preview.4.22229.4 140 07/20/2024
7.0.0-preview.3.22175.4 144 07/20/2024
7.0.0-preview.2.22152.2 160 07/20/2024
7.0.0-preview.1.22076.8 136 07/20/2024
6.0.1 103 11/14/2024
6.0.0 130 07/20/2024
6.0.0-rc.2.21480.5 129 07/20/2024
6.0.0-rc.1.21451.13 137 07/20/2024
6.0.0-preview.7.21377.19 131 07/20/2024
6.0.0-preview.6.21352.12 130 07/20/2024
6.0.0-preview.5.21301.5 131 07/20/2024
6.0.0-preview.4.21253.7 125 07/20/2024
6.0.0-preview.3.21201.4 152 07/20/2024
6.0.0-preview.2.21154.6 133 07/20/2024
6.0.0-preview.1.21102.12 151 07/20/2024
5.0.0 138 07/20/2024
5.0.0-rc.2.20475.5 133 07/20/2024
5.0.0-rc.1.20451.14 152 07/20/2024
5.0.0-preview.8.20407.11 128 07/20/2024
5.0.0-preview.7.20364.11 144 07/20/2024
5.0.0-preview.6.20305.6 133 07/20/2024
5.0.0-preview.5.20278.1 136 07/20/2024
5.0.0-preview.4.20251.6 141 07/20/2024
5.0.0-preview.3.20215.2 143 07/20/2024
5.0.0-preview.2.20160.3 143 07/20/2024
5.0.0-preview.1.20120.4 133 07/20/2024
3.1.32 131 07/20/2024
3.1.31 128 07/20/2024
3.1.30 129 07/20/2024
3.1.29 126 07/20/2024
3.1.28 132 07/20/2024
3.1.27 131 07/20/2024
3.1.26 130 07/20/2024
3.1.25 132 07/20/2024
3.1.24 145 07/20/2024
3.1.23 140 07/20/2024
3.1.22 141 07/20/2024
3.1.21 123 07/20/2024
3.1.20 123 07/20/2024
3.1.19 116 07/20/2024
3.1.18 127 07/20/2024
3.1.17 134 07/20/2024
3.1.16 124 07/20/2024
3.1.15 128 07/20/2024
3.1.14 147 07/20/2024
3.1.13 147 07/20/2024
3.1.12 136 07/20/2024
3.1.11 133 07/20/2024
3.1.10 145 07/20/2024
3.1.9 140 07/20/2024
3.1.8 119 07/20/2024
3.1.7 138 07/20/2024
3.1.6 120 07/20/2024
3.1.5 137 07/20/2024
3.1.4 141 07/20/2024
3.1.3 126 07/20/2024
3.1.2 155 07/20/2024
3.1.1 138 07/20/2024
3.1.0 149 07/20/2024
3.1.0-preview3.19553.2 148 07/20/2024
3.1.0-preview2.19525.4 134 07/20/2024
3.1.0-preview1.19506.1 134 07/20/2024
3.0.3 137 07/20/2024
3.0.2 135 07/20/2024
3.0.1 148 07/20/2024
3.0.0 128 07/20/2024
3.0.0-rc1.19456.10 124 07/20/2024
3.0.0-preview9.19423.4 139 07/20/2024
3.0.0-preview8.19405.4 156 07/20/2024
3.0.0-preview7.19362.4 139 07/20/2024
3.0.0-preview6.19304.6 133 07/20/2024
3.0.0-preview5.19227.9 133 07/20/2024
3.0.0-preview4.19216.2 154 07/20/2024
3.0.0-preview3.19153.1 146 07/20/2024
3.0.0-preview.19074.2 144 07/20/2024
3.0.0-preview.18572.1 129 07/20/2024
2.2.0 121 07/20/2024
2.2.0-preview3-35497 126 07/20/2024
2.2.0-preview2-35157 126 07/20/2024
2.2.0-preview1-35029 133 07/20/2024
2.1.1 134 07/20/2024
2.1.0 131 07/20/2024
2.1.0-rc1-final 131 07/20/2024
2.1.0-preview2-final 136 07/20/2024
2.1.0-preview1-final 138 07/20/2024
2.0.2 132 07/20/2024
2.0.1 126 07/20/2024
2.0.0 139 07/20/2024
2.0.0-preview2-final 140 07/20/2024
2.0.0-preview1-final 142 07/20/2024
1.1.2 132 07/20/2024
1.1.1 133 07/20/2024
1.1.0 142 07/20/2024
1.1.0-preview1-final 129 07/20/2024
1.0.2 145 07/20/2024
1.0.1 141 07/20/2024
1.0.0 137 07/20/2024
1.0.0-rc2-final 136 07/20/2024
1.0.0-rc1-final 137 07/20/2024