Microsoft.Extensions.Logging.Console 9.0.9
About
Microsoft.Extensions.Logging.Console provides a Console logger provider implementation for Microsoft.Extensions.Logging. It provides extension methods for the ILoggingBuilder and ILoggerProviderConfiguration classes.
Key Features
- Allow logging to the console using the Microsoft.Extensions.Logging package.
- Provide extension methods for the ILoggingBuilder and ILoggerProviderConfiguration classes.
How to Use
using System;
using Microsoft.Extensions.Logging;
namespace ConsoleLoggerSample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a logger factory with a console provider
            using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
            // 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:
- ConsoleLoggerProvider
- ConsoleLoggerSettings
- ConsoleLoggerOptions
- ConsoleLoggerExtensions
- ConsoleFormatter
- ConsoleFormatterOptions
- JsonConsoleFormatterOptions
- SimpleConsoleFormatterOptions
Additional Documentation
Related Packages
Microsoft.Extensions.Logging.Abstractions Microsoft.Extensions.Logging Microsoft.Extensions.Logging.Debug Microsoft.Extensions.Logging.EventSource Microsoft.Extensions.Logging.EventLog Microsoft.Extensions.Logging.TraceSource
Feedback & Contributing
Microsoft.Extensions.Logging.Console 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.Console.
| Packages | Downloads | 
|---|---|
| Microsoft.Extensions.Hosting Hosting and startup infrastructures for applications. | 2,642 | 
| Microsoft.Extensions.Hosting Hosting and startup infrastructures for applications. | 2,619 | 
| Microsoft.AspNetCore.NodeServices Invoke Node.js modules at runtime in ASP.NET Core applications.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/a4938d07a5127ffad8466ddf703a6b5b21f4b0c9 | 83 | 
| Microsoft.Extensions.Hosting .NET Core hosting and startup infrastructures for applications. | 82 | 
| Microsoft.AspNetCore Microsoft.AspNetCore | 77 | 
| Microsoft.Extensions.Hosting .NET Core hosting and startup infrastructures for applications. | 76 | 
| Microsoft.Extensions.Hosting Hosting and startup infrastructures for applications. | 74 | 
| Microsoft.Extensions.Hosting Hosting and startup infrastructures for applications. 
When using NuGet 3.x this package requires at least version 3.4. | 73 | 
| Microsoft.Extensions.Hosting .NET Core hosting and startup infrastructures for applications. | 73 | 
| Microsoft.Extensions.Hosting .NET Core hosting and startup infrastructures for applications. | 71 | 
| Microsoft.Extensions.Hosting .NET Core hosting and startup infrastructures for applications. | 70 | 
| Microsoft.Extensions.Hosting .NET Core hosting and startup infrastructures for applications. | 68 | 
| Microsoft.Extensions.Hosting .NET Core hosting and startup infrastructures for applications. | 67 | 
| Microsoft.Extensions.Hosting Hosting and startup infrastructures for applications. | 66 | 
| Microsoft.Extensions.Hosting Hosting and startup infrastructures for applications. 
When using NuGet 3.x this package requires at least version 3.4. | 66 | 
| Microsoft.AspNetCore Microsoft.AspNetCore | 65 | 
| Microsoft.AspNetCore.NodeServices Invoke Node.js modules at runtime in ASP.NET Core applications. | 65 | 
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.9)
- Microsoft.Extensions.Logging (>= 9.0.9)
- System.Text.Json (>= 9.0.9)
- Microsoft.Extensions.Options (>= 9.0.9)
- System.Buffers (>= 4.5.1)
.NET Standard 2.0
- System.Buffers (>= 4.5.1)
- System.Text.Json (>= 9.0.9)
- Microsoft.Extensions.Options (>= 9.0.9)
- Microsoft.Extensions.Logging (>= 9.0.9)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.9)
.NET 9.0
- Microsoft.Extensions.Options (>= 9.0.9)
- Microsoft.Extensions.Logging (>= 9.0.9)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.9)
.NET 8.0
- Microsoft.Extensions.Options (>= 9.0.9)
- System.Text.Json (>= 9.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.9)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.9)
- Microsoft.Extensions.Logging (>= 9.0.9)
| Version | Downloads | Last updated | 
|---|---|---|
| 10.0.0-rc.2.25502.107 | 4 | 10/16/2025 | 
| 10.0.0-rc.1.25451.107 | 11 | 09/11/2025 | 
| 10.0.0-preview.7.25380.108 | 13 | 08/14/2025 | 
| 10.0.0-preview.6.25358.103 | 13 | 07/16/2025 | 
| 10.0.0-preview.5.25277.114 | 15 | 06/14/2025 | 
| 10.0.0-preview.4.25258.110 | 20 | 05/17/2025 | 
| 10.0.0-preview.3.25171.5 | 22 | 04/12/2025 | 
| 10.0.0-preview.2.25163.2 | 28 | 03/20/2025 | 
| 10.0.0-preview.1.25080.5 | 29 | 03/01/2025 | 
| 9.0.10 | 3 | 10/16/2025 | 
| 9.0.9 | 9 | 09/11/2025 | 
| 9.0.8 | 10 | 08/07/2025 | 
| 9.0.7 | 14 | 07/10/2025 | 
| 9.0.6 | 22 | 06/12/2025 | 
| 9.0.5 | 20 | 05/17/2025 | 
| 9.0.4 | 22 | 04/10/2025 | 
| 9.0.3 | 26 | 03/14/2025 | 
| 9.0.2 | 26 | 02/15/2025 | 
| 9.0.1 | 31 | 01/20/2025 | 
| 9.0.0 | 40 | 11/17/2024 | 
| 9.0.0-rc.2.24473.5 | 37 | 10/15/2024 | 
| 9.0.0-rc.1.24431.7 | 41 | 09/12/2024 | 
| 9.0.0-preview.7.24405.7 | 45 | 08/14/2024 | 
| 9.0.0-preview.6.24327.7 | 44 | 07/11/2024 | 
| 9.0.0-preview.5.24306.7 | 52 | 06/15/2024 | 
| 9.0.0-preview.4.24266.19 | 40 | 05/23/2024 | 
| 9.0.0-preview.3.24172.9 | 44 | 04/13/2024 | 
| 9.0.0-preview.2.24128.5 | 54 | 03/14/2024 | 
| 9.0.0-preview.1.24080.9 | 46 | 03/08/2024 | 
| 8.0.1 | 51 | 10/09/2024 | 
| 8.0.0 | 2,631 | 11/14/2023 | 
| 8.0.0-rc.2.23479.6 | 59 | 10/24/2023 | 
| 8.0.0-rc.1.23419.4 | 43 | 09/16/2023 | 
| 8.0.0-preview.7.23375.6 | 43 | 09/03/2023 | 
| 8.0.0-preview.6.23329.7 | 56 | 07/20/2023 | 
| 8.0.0-preview.5.23280.8 | 62 | 07/12/2023 | 
| 8.0.0-preview.4.23259.5 | 57 | 06/28/2023 | 
| 8.0.0-preview.3.23174.8 | 51 | 06/29/2023 | 
| 8.0.0-preview.2.23128.3 | 54 | 07/13/2023 | 
| 8.0.0-preview.1.23110.8 | 58 | 02/27/2023 | 
| 7.0.0 | 56 | 05/07/2023 | 
| 7.0.0-rc.2.22472.3 | 62 | 07/24/2023 | 
| 7.0.0-rc.1.22426.10 | 55 | 05/01/2023 | 
| 7.0.0-preview.7.22375.6 | 60 | 04/30/2023 | 
| 7.0.0-preview.6.22324.4 | 55 | 10/07/2022 | 
| 7.0.0-preview.5.22301.12 | 54 | 07/17/2023 | 
| 7.0.0-preview.4.22229.4 | 62 | 05/27/2023 | 
| 7.0.0-preview.3.22175.4 | 57 | 07/16/2023 | 
| 7.0.0-preview.2.22152.2 | 51 | 06/13/2023 | 
| 7.0.0-preview.1.22076.8 | 53 | 04/24/2023 | 
| 6.0.2-mauipre.1.22102.15 | 58 | 05/21/2023 | 
| 6.0.2-mauipre.1.22054.8 | 52 | 06/24/2023 | 
| 6.0.1 | 37 | 11/17/2024 | 
| 6.0.0 | 2,627 | 12/07/2021 | 
| 6.0.0-rc.2.21480.5 | 48 | 07/20/2023 | 
| 6.0.0-rc.1.21451.13 | 53 | 08/11/2023 | 
| 6.0.0-preview.7.21377.19 | 61 | 12/20/2021 | 
| 6.0.0-preview.6.21352.12 | 40 | 12/20/2021 | 
| 6.0.0-preview.5.21301.5 | 57 | 05/18/2023 | 
| 6.0.0-preview.4.21253.7 | 44 | 07/19/2023 | 
| 6.0.0-preview.3.21201.4 | 49 | 05/15/2023 | 
| 6.0.0-preview.2.21154.6 | 46 | 07/05/2023 | 
| 6.0.0-preview.1.21102.12 | 53 | 05/17/2023 | 
| 5.0.0 | 50 | 01/27/2023 | 
| 5.0.0-rc.2.20475.5 | 50 | 05/31/2023 | 
| 5.0.0-rc.1.20451.14 | 51 | 05/13/2023 | 
| 5.0.0-preview.8.20407.11 | 47 | 09/10/2022 | 
| 5.0.0-preview.7.20364.11 | 55 | 01/06/2023 | 
| 5.0.0-preview.6.20305.6 | 53 | 08/28/2022 | 
| 5.0.0-preview.5.20278.1 | 53 | 05/15/2023 | 
| 5.0.0-preview.4.20251.6 | 64 | 05/23/2023 | 
| 5.0.0-preview.3.20215.2 | 49 | 05/15/2023 | 
| 5.0.0-preview.2.20160.3 | 49 | 05/19/2023 | 
| 5.0.0-preview.1.20120.4 | 58 | 06/05/2023 | 
| 3.1.32 | 53 | 03/01/2023 | 
| 3.1.31 | 49 | 05/10/2023 | 
| 3.1.30 | 51 | 02/04/2023 | 
| 3.1.29 | 51 | 11/10/2022 | 
| 3.1.28 | 59 | 03/22/2023 | 
| 3.1.27 | 53 | 03/28/2023 | 
| 3.1.26 | 48 | 04/30/2023 | 
| 3.1.25 | 52 | 05/21/2023 | 
| 3.1.24 | 65 | 10/26/2022 | 
| 3.1.23 | 56 | 03/24/2023 | 
| 3.1.22 | 52 | 05/05/2023 | 
| 3.1.21 | 51 | 10/02/2022 | 
| 3.1.20 | 46 | 05/12/2023 | 
| 3.1.19 | 55 | 03/22/2023 | 
| 3.1.18 | 45 | 02/16/2023 | 
| 3.1.17 | 54 | 05/08/2023 | 
| 3.1.16 | 55 | 03/31/2023 | 
| 3.1.15 | 56 | 04/17/2023 | 
| 3.1.14 | 56 | 12/03/2022 | 
| 3.1.13 | 52 | 02/27/2023 | 
| 3.1.12 | 61 | 03/21/2021 | 
| 3.1.11 | 62 | 06/11/2022 | 
| 3.1.10 | 50 | 02/05/2023 | 
| 3.1.9 | 51 | 01/28/2023 | 
| 3.1.8 | 52 | 01/09/2023 | 
| 3.1.7 | 52 | 11/09/2020 | 
| 3.1.6 | 50 | 04/13/2023 | 
| 3.1.5 | 53 | 03/07/2023 | 
| 3.1.4 | 54 | 01/10/2023 | 
| 3.1.3 | 52 | 08/27/2022 | 
| 3.1.2 | 49 | 01/14/2023 | 
| 3.1.1 | 49 | 02/07/2023 | 
| 3.1.0 | 53 | 10/19/2022 | 
| 3.1.0-preview3.19553.2 | 50 | 07/24/2023 | 
| 3.1.0-preview2.19525.4 | 55 | 07/24/2023 | 
| 3.1.0-preview1.19506.1 | 46 | 05/06/2023 | 
| 3.0.3 | 49 | 02/05/2023 | 
| 3.0.2 | 60 | 01/25/2023 | 
| 3.0.1 | 51 | 02/11/2023 | 
| 3.0.0 | 60 | 12/20/2021 | 
| 3.0.0-rc1.19456.10 | 50 | 05/11/2023 | 
| 3.0.0-preview9.19423.4 | 49 | 11/21/2022 | 
| 3.0.0-preview8.19405.4 | 56 | 04/22/2023 | 
| 3.0.0-preview7.19362.4 | 58 | 05/12/2023 | 
| 3.0.0-preview6.19304.6 | 60 | 10/20/2022 | 
| 3.0.0-preview5.19227.9 | 53 | 05/15/2023 | 
| 3.0.0-preview4.19216.2 | 51 | 11/05/2022 | 
| 3.0.0-preview3.19153.1 | 58 | 04/26/2023 | 
| 3.0.0-preview.19074.2 | 48 | 07/18/2023 | 
| 3.0.0-preview.18572.1 | 51 | 05/10/2023 | 
| 2.2.0 | 56 | 12/20/2021 | 
| 2.2.0-preview3-35497 | 58 | 01/21/2023 | 
| 2.2.0-preview2-35157 | 51 | 05/19/2023 | 
| 2.2.0-preview1-35029 | 50 | 01/29/2023 | 
| 2.1.1 | 53 | 01/14/2023 | 
| 2.1.0 | 48 | 01/19/2023 | 
| 2.1.0-rc1-final | 51 | 02/20/2023 | 
| 2.1.0-preview2-final | 51 | 02/01/2023 | 
| 2.1.0-preview1-final | 66 | 12/10/2022 | 
| 2.0.2 | 48 | 03/22/2023 | 
| 2.0.1 | 69 | 12/20/2021 | 
| 2.0.0 | 54 | 06/07/2022 | 
| 2.0.0-preview2-final | 59 | 03/17/2023 | 
| 2.0.0-preview1-final | 54 | 04/01/2023 | 
| 1.1.2 | 53 | 10/15/2022 | 
| 1.1.1 | 53 | 02/13/2023 | 
| 1.1.0 | 54 | 12/20/2021 | 
| 1.1.0-preview1-final | 50 | 04/16/2023 | 
| 1.0.2 | 49 | 10/02/2022 | 
| 1.0.1 | 52 | 12/20/2021 | 
| 1.0.0 | 53 | 12/20/2021 | 
| 1.0.0-rc2-final | 45 | 02/18/2023 | 
| 1.0.0-rc1-final | 52 | 01/22/2023 |