Microsoft.Extensions.Logging.Console 10.0.13

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
.NET Core hosting and startup infrastructures for applications.
72
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
72
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
71
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
71
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
70
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
70
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications. When using NuGet 3.x this package requires at least version 3.4.
70
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
69
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
69

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