Microsoft.Extensions.Logging.Console 10.0.12

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. 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.
39
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
38
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
34
Amazon.JSII.Runtime
.NET client for jsii runtime
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
.NET Core hosting and startup infrastructures for applications.
32
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
32
Amazon.JSII.Runtime
.NET client for jsii runtime
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
Amazon.JSII.Runtime
.NET client for jsii runtime
30
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
30

.NET Framework 4.6.2

.NET 8.0

.NET 9.0

.NET 10.0

.NET Standard 2.0

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