Microsoft.Extensions.Logging.Console 9.0.23

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.Extensions.Hosting
Hosting and startup infrastructures for applications.
2,297
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
111
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
73
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
72
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications. When using NuGet 3.x this package requires at least version 3.4.
71
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
70
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
70
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
70
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
69
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/c5f85986e62dabfc0b7f2f2a45dc7c22e8ac815f
69
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
69
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/8ca3954ca335343ce6dd1d14d8d1c6c3369710b7
68
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
68
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
68
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
67

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