Microsoft.Extensions.Logging.Console 10.0.0

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

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

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.AspNetCore
Microsoft.AspNetCore
63
Microsoft.AspNetCore
Microsoft.AspNetCore
64
Microsoft.AspNetCore
Microsoft.AspNetCore
66
Microsoft.AspNetCore
Microsoft.AspNetCore
68
Microsoft.AspNetCore
Microsoft.AspNetCore
72
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.
73
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.
62
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/aspnet/AspNetCore/tree/509f6badec2f3162f0e50330cd9107e5624b379b
77
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
66
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
76
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
258
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
66
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
5,381
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
9,215
nacos-sdk-csharp.Extensions.Configuration
nacos csharp sdk
62
nacos-sdk-csharp.Extensions.Configuration
nacos csharp sdk
97
PDFsharp
PDFsharp is the Open Source library for creating and modifying PDF documents using .NET. It has an easy-to-use API that allows developers to generate or modify PDF files programmatically. PDFsharp can be used for various applications, including creating reports, invoices, and other types of documents. This package does not depend on Windows and can be used on any .NET compatible platform including Linux and macOS. See https://docs.pdfsharp.net for details.
67
PDFsharp
PDFsharp is the Open Source library for creating and modifying PDF documents using .NET. It has an easy-to-use API that allows developers to generate or modify PDF files programmatically. PDFsharp can be used for various applications, including creating reports, invoices, and other types of documents. This package does not depend on Windows and can be used on any .NET compatible platform including Linux and macOS. See https://docs.pdfsharp.net for details.
70
Pomelo.EntityFrameworkCore.MySql.Design
Package Description
66
Quantum.FrameworkNetCore
Used for set up Micro-Service.
66

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

.NET Framework 4.6.2

.NET Standard 2.0

.NET 10.0

.NET 9.0

.NET 8.0

Version Downloads Last updated
10.0.0 45 11/13/2025
10.0.0-rc.2.25502.107 27 10/17/2025
10.0.0-rc.1.25451.107 28 09/12/2025
10.0.0-preview.7.25380.108 32 08/15/2025
10.0.0-preview.6.25358.103 27 07/17/2025
10.0.0-preview.5.25277.114 40 06/10/2025
10.0.0-preview.4.25258.110 35 05/15/2025
10.0.0-preview.3.25171.5 32 04/26/2025
10.0.0-preview.2.25163.2 33 03/30/2025
10.0.0-preview.1.25080.5 36 03/12/2025
9.0.11 23 11/14/2025
9.0.10 22 10/17/2025
9.0.9 25 09/11/2025
9.0.8 32 08/08/2025
9.0.7 30 07/13/2025
9.0.6 36 06/13/2025
9.0.5 44 05/16/2025
9.0.4 33 04/27/2025
9.0.3 38 03/12/2025
9.0.2 35 03/12/2025
9.0.1 46 01/28/2025
9.0.0 54 11/15/2024
9.0.0-rc.2.24473.5 40 11/14/2024
9.0.0-rc.1.24431.7 35 11/28/2024
9.0.0-preview.7.24405.7 37 11/14/2024
9.0.0-preview.6.24327.7 36 11/14/2024
9.0.0-preview.5.24306.7 43 11/12/2024
9.0.0-preview.4.24266.19 47 05/21/2024
9.0.0-preview.3.24172.9 47 05/05/2024
9.0.0-preview.2.24128.5 38 04/28/2024
9.0.0-preview.1.24080.9 47 05/02/2024
8.0.1 49 11/12/2024
8.0.0 266 02/04/2024
8.0.0-rc.2.23479.6 44 05/29/2024
8.0.0-rc.1.23419.4 43 04/30/2024
8.0.0-preview.7.23375.6 51 05/29/2024
8.0.0-preview.6.23329.7 49 08/07/2023
8.0.0-preview.5.23280.8 44 05/15/2024
8.0.0-preview.4.23259.5 47 05/21/2024
8.0.0-preview.3.23174.8 47 05/02/2024
8.0.0-preview.2.23128.3 44 05/02/2024
8.0.0-preview.1.23110.8 49 05/02/2024
7.0.0 67 02/02/2023
7.0.0-rc.2.22472.3 45 05/14/2024
7.0.0-rc.1.22426.10 43 05/04/2024
7.0.0-preview.7.22375.6 36 05/29/2024
7.0.0-preview.6.22324.4 47 04/24/2024
7.0.0-preview.5.22301.12 45 11/28/2024
7.0.0-preview.4.22229.4 45 05/29/2024
7.0.0-preview.3.22175.4 39 05/29/2024
7.0.0-preview.2.22152.2 40 05/29/2024
7.0.0-preview.1.22076.8 39 05/29/2024
6.0.2-mauipre.1.22102.15 43 05/11/2024
6.0.2-mauipre.1.22054.8 35 05/29/2024
6.0.1 45 11/28/2024
6.0.0 85 07/01/2022
6.0.0-rc.2.21480.5 42 05/25/2024
6.0.0-rc.1.21451.13 40 02/09/2023
6.0.0-preview.7.21377.19 40 05/29/2024
6.0.0-preview.6.21352.12 44 05/04/2024
6.0.0-preview.5.21301.5 46 05/19/2024
6.0.0-preview.4.21253.7 38 05/29/2024
6.0.0-preview.3.21201.4 36 05/29/2024
6.0.0-preview.2.21154.6 45 04/30/2024
6.0.0-preview.1.21102.12 37 05/29/2024
5.0.0-rc.2.20475.5 44 05/11/2024
5.0.0-rc.1.20451.14 42 05/20/2024
5.0.0-preview.8.20407.11 44 05/29/2024
5.0.0-preview.7.20364.11 43 05/29/2024
5.0.0-preview.6.20305.6 45 05/01/2024
5.0.0-preview.5.20278.1 42 05/23/2024
5.0.0-preview.4.20251.6 38 05/02/2024
5.0.0-preview.3.20215.2 42 05/25/2024
5.0.0-preview.1.20120.4 49 05/02/2024
3.1.32 9,219 05/12/2023
3.1.31 48 05/17/2024
3.1.30 5,449 11/03/2022
3.1.29 40 05/19/2024
3.1.28 48 05/10/2024
3.1.27 41 05/26/2024
3.1.26 42 05/23/2024
3.1.25 48 05/11/2024
3.1.14 49 05/25/2024
3.1.13 50 02/24/2023
3.1.11 54 05/29/2024
3.1.3 45 05/09/2024
3.1.1 46 05/29/2024
3.1.0-preview3.19553.2 40 11/04/2022
3.1.0-preview2.19525.4 45 05/29/2024
3.1.0-preview1.19506.1 50 05/02/2024
3.0.1 47 05/29/2024
3.0.0-rc1.19456.10 45 05/29/2024
3.0.0-preview5.19227.9 42 05/02/2024
3.0.0-preview3.19153.1 47 05/18/2024
3.0.0-preview.18572.1 40 05/29/2024
2.2.0 51 08/17/2023
2.2.0-preview3-35497 52 05/07/2024
2.2.0-preview2-35157 41 05/25/2024
2.1.0-rc1-final 51 05/13/2024
2.0.0 46 05/11/2024
1.1.2 43 05/06/2024
1.1.0 48 05/29/2024
1.1.0-preview1-final 45 05/14/2024
1.0.0 44 05/02/2024
1.0.0-rc2-final 47 05/02/2024
1.0.0-rc1-final 47 05/02/2024