Microsoft.Extensions.Logging.Debug 9.0.18

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:

  • DebugLoggerProvider
  • DebugLoggerFactoryExtensions

Additional Documentation

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. When using NuGet 3.x this package requires at least version 3.4.
374
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
55
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
40
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
38
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
34
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
33
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
33
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
32
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications. When using NuGet 3.x this package requires at least version 3.4.
31
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
31
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
31
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
30
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.
29
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
29

Version Downloads Last updated
11.0.0 1 11/13/2026
11.0.0-rc.3.26522.148 2 11/03/2026
11.0.0-rc.2.26504.105 6 10/14/2026
11.0.0-rc.1.26425.128 19 09/11/2026
11.0.0-preview.7.26381.103 17 08/11/2026
11.0.0-preview.6.26359.118 16 07/17/2026
11.0.0-preview.5.26302.115 10 06/25/2026
11.0.0-preview.4.26230.115 14 05/14/2026
11.0.0-preview.3.26207.106 15 07/05/2026
11.0.0-preview.2.26159.112 11 07/05/2026
11.0.0-preview.1.26104.118 11 04/17/2026
10.0.15 1 11/14/2026
10.0.14 7 11/04/2026
10.0.13 4 10/14/2026
10.0.12 5 10/04/2026
10.0.11 8 08/11/2026
10.0.10 12 07/15/2026
10.0.9 15 06/26/2026
10.0.8 11 05/14/2026
10.0.7 15 04/22/2026
10.0.6 13 04/23/2026
10.0.5 18 04/29/2026
10.0.4 13 05/15/2026
10.0.3 13 04/17/2026
10.0.2 18 01/23/2026
10.0.1 14 12/21/2025
10.0.0 17 11/29/2025
10.0.0-rc.2.25502.107 19 10/15/2025
10.0.0-rc.1.25451.107 13 06/26/2026
10.0.0-preview.7.25380.108 11 08/16/2025
10.0.0-preview.6.25358.103 12 07/21/2025
10.0.0-preview.5.25277.114 13 08/20/2025
10.0.0-preview.4.25258.110 15 06/26/2026
10.0.0-preview.3.25171.5 16 04/12/2025
10.0.0-preview.2.25163.2 16 03/22/2025
10.0.0-preview.1.25080.5 7 07/06/2026
9.0.23 0 11/10/2026
9.0.22 3 11/11/2026
9.0.21 4 10/14/2026
9.0.20 11 09/13/2026
9.0.19 9 08/11/2026
9.0.18 12 07/16/2026
9.0.17 12 06/27/2026
9.0.16 14 06/27/2026
9.0.15 14 06/27/2026
9.0.14 15 06/26/2026
9.0.13 18 06/26/2026
9.0.12 14 06/27/2026
9.0.11 13 06/26/2026
9.0.10 10 06/26/2026
9.0.9 12 06/28/2026
9.0.8 11 06/26/2026
9.0.7 12 06/26/2026
9.0.6 12 06/26/2026
9.0.5 23 05/31/2025
9.0.4 19 04/12/2025
9.0.3 15 03/22/2025
9.0.2 22 02/11/2025
9.0.1 20 01/17/2025
9.0.0 17 11/12/2024
9.0.0-rc.2.24473.5 18 10/13/2024
9.0.0-rc.1.24431.7 11 09/15/2024
9.0.0-preview.7.24405.7 12 08/15/2024
9.0.0-preview.6.24327.7 17 07/27/2024
9.0.0-preview.5.24306.7 13 06/14/2024
9.0.0-preview.4.24266.19 14 06/02/2024
9.0.0-preview.3.24172.9 13 05/30/2024
9.0.0-preview.2.24128.5 13 07/01/2026
9.0.0-preview.1.24080.9 10 08/09/2026
8.0.1 15 06/16/2025
8.0.0 50 12/26/2023
8.0.0-rc.2.23479.6 15 10/21/2024
8.0.0-rc.1.23419.4 14 10/26/2024
8.0.0-preview.7.23375.6 12 04/03/2024
8.0.0-preview.6.23329.7 13 10/11/2024
8.0.0-preview.5.23280.8 13 10/13/2024
8.0.0-preview.4.23259.5 11 07/03/2026
8.0.0-preview.3.23174.8 16 06/24/2024
8.0.0-preview.2.23128.3 17 05/26/2025
8.0.0-preview.1.23110.8 14 12/16/2023
7.0.0 24 03/06/2024
7.0.0-rc.2.22472.3 16 03/26/2024
7.0.0-rc.1.22426.10 19 12/14/2023
7.0.0-preview.7.22375.6 13 06/30/2026
7.0.0-preview.6.22324.4 12 10/06/2024
7.0.0-preview.5.22301.12 12 02/23/2024
7.0.0-preview.4.22229.4 14 02/23/2024
7.0.0-preview.3.22175.4 25 02/26/2024
7.0.0-preview.2.22152.2 18 02/20/2025
7.0.0-preview.1.22076.8 14 03/11/2024
6.0.2-mauipre.1.22102.15 11 02/29/2024
6.0.1 14 06/26/2026
6.0.0 16 04/17/2022
6.0.0-rc.2.21480.5 16 04/02/2024
6.0.0-rc.1.21451.13 17 05/06/2024
6.0.0-preview.7.21377.19 12 01/22/2024
6.0.0-preview.6.21352.12 15 03/14/2025
6.0.0-preview.5.21301.5 12 12/24/2023
6.0.0-preview.4.21253.7 14 05/07/2025
6.0.0-preview.3.21201.4 17 01/24/2024
6.0.0-preview.2.21154.6 11 10/09/2024
6.0.0-preview.1.21102.12 10 05/07/2024
5.0.0 377 04/18/2022
5.0.0-rc.2.20475.5 20 12/24/2023
5.0.0-rc.1.20451.14 15 12/20/2023
5.0.0-preview.8.20407.11 14 04/18/2024
5.0.0-preview.7.20364.11 13 08/13/2024
5.0.0-preview.6.20305.6 12 04/22/2024
5.0.0-preview.5.20278.1 12 11/01/2024
5.0.0-preview.4.20251.6 13 02/17/2024
5.0.0-preview.3.20215.2 17 01/09/2024
5.0.0-preview.2.20160.3 16 06/07/2025
5.0.0-preview.1.20120.4 12 09/12/2024
3.1.32 12 06/09/2024
3.1.31 16 12/13/2023
3.1.30 9 06/27/2026
3.1.29 16 10/09/2024
3.1.28 18 12/20/2023
3.1.27 15 10/05/2024
3.1.26 15 08/21/2024
3.1.25 16 11/17/2024
3.1.24 16 10/28/2024
3.1.23 14 06/27/2026
3.1.22 15 04/08/2024
3.1.21 16 10/10/2024
3.1.20 17 01/29/2024
3.1.19 16 04/08/2025
3.1.18 17 10/06/2024
3.1.17 14 08/13/2024
3.1.16 18 03/29/2024
3.1.15 16 01/06/2024
3.1.14 15 12/12/2023
3.1.13 14 02/08/2024
3.1.12 17 07/06/2026
3.1.11 15 12/27/2023
3.1.10 18 08/04/2024
3.1.9 10 08/13/2024
3.1.8 16 01/27/2025
3.1.7 12 06/26/2026
3.1.6 19 12/31/2023
3.1.5 15 06/26/2026
3.1.4 17 03/22/2024
3.1.3 17 12/28/2023
3.1.2 22 04/22/2024
3.1.1 15 12/31/2023
3.1.0 24 02/21/2022
3.1.0-preview3.19553.2 9 07/05/2026
3.1.0-preview2.19525.4 18 08/25/2024
3.1.0-preview1.19506.1 18 02/20/2024
3.0.3 18 01/06/2025
3.0.2 13 05/04/2024
3.0.1 13 06/27/2026
3.0.0 23 12/12/2023
3.0.0-rc1.19456.10 14 11/11/2025
3.0.0-preview9.19423.4 14 02/06/2024
3.0.0-preview8.19405.4 15 01/02/2024
3.0.0-preview7.19362.4 17 01/05/2024
3.0.0-preview6.19304.6 11 06/29/2026
3.0.0-preview5.19227.9 15 10/12/2024
3.0.0-preview4.19216.2 14 09/30/2024
3.0.0-preview3.19153.1 12 06/13/2025
3.0.0-preview.19074.2 14 11/21/2024
3.0.0-preview.18572.1 19 05/13/2024
2.2.0 16 12/15/2023
2.2.0-preview3-35497 15 02/29/2024
2.2.0-preview2-35157 12 06/26/2026
2.2.0-preview1-35029 19 12/27/2023
2.1.1 21 09/03/2021
2.1.0 21 11/18/2021
2.1.0-rc1-final 12 10/08/2024
2.1.0-preview2-final 16 12/13/2023
2.1.0-preview1-final 13 12/26/2024
2.0.2 14 11/18/2025
2.0.1 14 11/05/2024
2.0.0 16 10/06/2024
2.0.0-preview2-final 16 06/20/2024
2.0.0-preview1-final 12 08/18/2024
1.1.2 22 12/23/2023
1.1.1 15 07/12/2024
1.1.0 13 02/01/2024
1.1.0-preview1-final 15 03/11/2024
1.0.2 15 02/21/2024
1.0.1 15 09/14/2025
1.0.0 21 01/20/2024
1.0.0-rc2-final 18 01/27/2024
1.0.0-rc1-final 14 11/19/2024