Microsoft.Extensions.Logging.Debug 10.0.0
About
Microsoft.Extensions.Logging.Debug provides a Debug output logger provider implementation for Microsoft.Extensions.Logging. This logger logs messages to a debugger monitor by writing messages with System.Diagnostics.Debug.WriteLine().
Key Features
- Allow logging to the debugger output.
- Provide extensions method for the ILoggingBuilder class to easily enable this Debug logger.
How to Use
using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Debug;
namespace DebugLoggerSample
{
class Program
{
static void Main(string[] args)
{
// Create a logger factory with a debug provider
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddDebug());
// Create a logger with the category name of the current class
ILogger<Program> logger = loggerFactory.CreateLogger<Program>();
// Log some messages with different log levels and message templates
logger.LogTrace("This is a trace message.");
logger.LogDebug("This is a debug message.");
logger.LogInformation("Hello {Name}!", "World");
logger.LogWarning("This is a warning message.");
logger.LogError("This is an error message.");
logger.LogCritical("This is a critical message.");
// Use structured logging to capture complex data
var person = new Person { Name = "Alice", Age = 25 };
logger.LogInformation("Created a new person: {@Person}", person);
// Use exception logging to capture the details of an exception
try
{
throw new Exception("Something went wrong.");
}
catch (Exception ex)
{
logger.LogError(ex, "An exception occurred.");
}
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
// A simple class to demonstrate structured logging
class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
}
Main Types
The main types provided by this library are:
DebugLoggerProviderDebugLoggerFactoryExtensions
Additional Documentation
Related Packages
Microsoft.Extensions.Logging.Abstractions Microsoft.Extensions.Logging Microsoft.Extensions.Logging.Console Microsoft.Extensions.Logging.EventSource Microsoft.Extensions.Logging.EventLog Microsoft.Extensions.Logging.TraceSource
Feedback & Contributing
Microsoft.Extensions.Logging.Debug 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.Debug.
| Packages | Downloads |
|---|---|
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
2,908 |
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
2,818 |
|
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
|
88 |
|
Microsoft.AspNetCore
Microsoft.AspNetCore
|
82 |
|
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
|
78 |
|
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
|
77 |
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
When using NuGet 3.x this package requires at least version 3.4.
|
77 |
|
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
|
75 |
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
75 |
|
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
|
74 |
|
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
|
73 |
|
Microsoft.AspNetCore
Microsoft.AspNetCore
|
70 |
|
Microsoft.AspNetCore
Microsoft.AspNetCore
|
69 |
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
69 |
|
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
|
69 |
|
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
When using NuGet 3.x this package requires at least version 3.4.
|
68 |
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
.NET Standard 2.0
- Microsoft.Extensions.Logging (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
.NET 10.0
- Microsoft.Extensions.Logging (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
.NET 9.0
- Microsoft.Extensions.Logging (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
.NET 8.0
- Microsoft.Extensions.Logging (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
| Version | Downloads | Last updated |
|---|---|---|
| 10.0.0 | 8 | 11/14/2025 |
| 10.0.0-rc.2.25502.107 | 5 | 10/16/2025 |
| 10.0.0-rc.1.25451.107 | 11 | 09/11/2025 |
| 10.0.0-preview.7.25380.108 | 13 | 08/17/2025 |
| 10.0.0-preview.6.25358.103 | 13 | 07/16/2025 |
| 10.0.0-preview.5.25277.114 | 16 | 06/09/2025 |
| 10.0.0-preview.4.25258.110 | 21 | 05/14/2025 |
| 10.0.0-preview.3.25171.5 | 19 | 04/12/2025 |
| 10.0.0-preview.2.25163.2 | 26 | 03/26/2025 |
| 10.0.0-preview.1.25080.5 | 19 | 02/25/2025 |
| 9.0.11 | 2 | 11/19/2025 |
| 9.0.10 | 4 | 10/16/2025 |
| 9.0.9 | 8 | 09/11/2025 |
| 9.0.8 | 10 | 08/05/2025 |
| 9.0.7 | 13 | 07/09/2025 |
| 9.0.6 | 18 | 06/14/2025 |
| 9.0.5 | 24 | 05/14/2025 |
| 9.0.4 | 21 | 04/12/2025 |
| 9.0.3 | 24 | 03/15/2025 |
| 9.0.2 | 27 | 02/11/2025 |
| 9.0.1 | 26 | 01/17/2025 |
| 9.0.0 | 2,341 | 11/13/2024 |
| 9.0.0-rc.2.24473.5 | 36 | 10/14/2024 |
| 9.0.0-rc.1.24431.7 | 38 | 09/10/2024 |
| 9.0.0-preview.7.24405.7 | 39 | 08/16/2024 |
| 9.0.0-preview.6.24327.7 | 44 | 07/10/2024 |
| 9.0.0-preview.5.24306.7 | 46 | 06/14/2024 |
| 9.0.0-preview.4.24266.19 | 42 | 06/09/2024 |
| 9.0.0-preview.3.24172.9 | 39 | 04/13/2024 |
| 9.0.0-preview.2.24128.5 | 44 | 03/14/2024 |
| 9.0.0-preview.1.24080.9 | 45 | 03/08/2024 |
| 8.0.1 | 33 | 10/11/2024 |
| 8.0.0 | 2,910 | 11/23/2023 |
| 8.0.0-rc.2.23479.6 | 57 | 10/10/2023 |
| 8.0.0-rc.1.23419.4 | 46 | 09/13/2023 |
| 8.0.0-preview.7.23375.6 | 62 | 08/17/2023 |
| 8.0.0-preview.6.23329.7 | 60 | 07/19/2023 |
| 8.0.0-preview.5.23280.8 | 49 | 07/05/2023 |
| 8.0.0-preview.4.23259.5 | 52 | 06/30/2023 |
| 8.0.0-preview.3.23174.8 | 45 | 06/30/2023 |
| 8.0.0-preview.2.23128.3 | 48 | 06/27/2023 |
| 8.0.0-preview.1.23110.8 | 46 | 06/26/2023 |
| 7.0.0 | 58 | 11/29/2022 |
| 7.0.0-rc.2.22472.3 | 49 | 06/26/2023 |
| 7.0.0-rc.1.22426.10 | 59 | 06/28/2023 |
| 7.0.0-preview.7.22375.6 | 56 | 08/22/2022 |
| 7.0.0-preview.6.22324.4 | 56 | 06/28/2023 |
| 7.0.0-preview.5.22301.12 | 59 | 08/03/2022 |
| 7.0.0-preview.4.22229.4 | 59 | 11/24/2022 |
| 7.0.0-preview.3.22175.4 | 51 | 04/27/2022 |
| 7.0.0-preview.2.22152.2 | 54 | 12/30/2022 |
| 7.0.0-preview.1.22076.8 | 73 | 10/12/2022 |
| 6.0.2-mauipre.1.22102.15 | 47 | 12/13/2022 |
| 6.0.2-mauipre.1.22054.8 | 52 | 11/16/2022 |
| 6.0.1 | 33 | 11/13/2024 |
| 6.0.0 | 2,802 | 12/15/2021 |
| 6.0.0-rc.2.21480.5 | 50 | 12/13/2022 |
| 6.0.0-rc.1.21451.13 | 57 | 12/01/2022 |
| 6.0.0-preview.7.21377.19 | 67 | 07/04/2022 |
| 6.0.0-preview.6.21352.12 | 54 | 06/29/2023 |
| 6.0.0-preview.5.21301.5 | 60 | 04/28/2022 |
| 6.0.0-preview.4.21253.7 | 53 | 06/26/2023 |
| 6.0.0-preview.3.21201.4 | 50 | 08/24/2022 |
| 6.0.0-preview.2.21154.6 | 48 | 04/27/2022 |
| 6.0.0-preview.1.21102.12 | 61 | 06/29/2023 |
| 5.0.0 | 57 | 12/24/2021 |
| 5.0.0-rc.2.20475.5 | 48 | 07/02/2023 |
| 5.0.0-rc.1.20451.14 | 60 | 09/15/2022 |
| 5.0.0-preview.8.20407.11 | 60 | 06/30/2023 |
| 5.0.0-preview.7.20364.11 | 61 | 11/07/2022 |
| 5.0.0-preview.6.20305.6 | 58 | 12/13/2022 |
| 5.0.0-preview.5.20278.1 | 56 | 12/13/2022 |
| 5.0.0-preview.4.20251.6 | 65 | 07/02/2023 |
| 5.0.0-preview.3.20215.2 | 60 | 06/09/2023 |
| 5.0.0-preview.2.20160.3 | 51 | 07/02/2023 |
| 5.0.0-preview.1.20120.4 | 60 | 12/17/2022 |
| 3.1.32 | 57 | 07/02/2023 |
| 3.1.31 | 52 | 06/09/2023 |
| 3.1.30 | 51 | 04/09/2023 |
| 3.1.29 | 52 | 06/30/2023 |
| 3.1.28 | 57 | 05/10/2023 |
| 3.1.27 | 52 | 06/02/2023 |
| 3.1.26 | 56 | 09/25/2022 |
| 3.1.25 | 53 | 07/21/2023 |
| 3.1.24 | 47 | 06/28/2023 |
| 3.1.23 | 53 | 06/29/2023 |
| 3.1.22 | 48 | 05/25/2023 |
| 3.1.21 | 57 | 03/05/2023 |
| 3.1.20 | 50 | 07/27/2022 |
| 3.1.19 | 46 | 06/30/2023 |
| 3.1.18 | 67 | 09/11/2022 |
| 3.1.17 | 65 | 08/21/2022 |
| 3.1.16 | 57 | 07/05/2022 |
| 3.1.15 | 49 | 07/02/2023 |
| 3.1.14 | 50 | 12/20/2021 |
| 3.1.13 | 52 | 06/27/2023 |
| 3.1.12 | 48 | 06/27/2023 |
| 3.1.11 | 47 | 06/11/2022 |
| 3.1.10 | 57 | 10/23/2022 |
| 3.1.9 | 51 | 12/03/2022 |
| 3.1.8 | 54 | 06/27/2023 |
| 3.1.7 | 53 | 06/29/2023 |
| 3.1.6 | 54 | 05/04/2023 |
| 3.1.5 | 57 | 10/02/2022 |
| 3.1.4 | 50 | 06/28/2023 |
| 3.1.3 | 53 | 04/13/2023 |
| 3.1.2 | 52 | 06/28/2023 |
| 3.1.1 | 47 | 06/29/2023 |
| 3.1.0 | 44 | 05/24/2023 |
| 3.1.0-preview3.19553.2 | 53 | 06/26/2023 |
| 3.1.0-preview2.19525.4 | 53 | 12/13/2022 |
| 3.1.0-preview1.19506.1 | 58 | 12/02/2022 |
| 3.0.3 | 56 | 11/28/2022 |
| 3.0.2 | 63 | 09/27/2022 |
| 3.0.1 | 59 | 06/30/2023 |
| 3.0.0 | 49 | 12/13/2022 |
| 3.0.0-rc1.19456.10 | 52 | 06/28/2023 |
| 3.0.0-preview9.19423.4 | 61 | 06/28/2023 |
| 3.0.0-preview8.19405.4 | 50 | 06/30/2023 |
| 3.0.0-preview7.19362.4 | 43 | 07/02/2023 |
| 3.0.0-preview6.19304.6 | 55 | 06/27/2023 |
| 3.0.0-preview5.19227.9 | 56 | 06/28/2023 |
| 3.0.0-preview4.19216.2 | 47 | 03/15/2023 |
| 3.0.0-preview3.19153.1 | 51 | 04/28/2022 |
| 3.0.0-preview.19074.2 | 49 | 09/23/2022 |
| 3.0.0-preview.18572.1 | 49 | 09/05/2022 |
| 2.2.0 | 60 | 12/13/2022 |
| 2.2.0-preview3-35497 | 46 | 11/13/2022 |
| 2.2.0-preview2-35157 | 47 | 06/30/2023 |
| 2.2.0-preview1-35029 | 59 | 06/29/2023 |
| 2.1.1 | 65 | 04/27/2022 |
| 2.1.0 | 48 | 06/24/2023 |
| 2.1.0-rc1-final | 50 | 12/15/2021 |
| 2.1.0-preview2-final | 44 | 06/30/2023 |
| 2.1.0-preview1-final | 45 | 04/06/2023 |
| 2.0.2 | 50 | 04/11/2023 |
| 2.0.1 | 56 | 12/15/2021 |
| 2.0.0 | 54 | 06/07/2022 |
| 2.0.0-preview2-final | 48 | 10/14/2022 |
| 2.0.0-preview1-final | 57 | 08/21/2022 |
| 1.1.2 | 61 | 12/03/2022 |
| 1.1.1 | 56 | 12/15/2021 |
| 1.1.0 | 53 | 12/04/2022 |
| 1.1.0-preview1-final | 42 | 06/27/2023 |
| 1.0.2 | 66 | 10/05/2022 |
| 1.0.1 | 51 | 05/07/2023 |
| 1.0.0 | 54 | 06/26/2023 |
| 1.0.0-rc2-final | 53 | 06/27/2023 |
| 1.0.0-rc1-final | 51 | 12/13/2022 |