Microsoft.Extensions.Logging.Console 10.0.0-rc.2.25502.107

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,480
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
2,457
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
79
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
79
Microsoft.AspNetCore
Microsoft.AspNetCore
76
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
74
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
73
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.
71
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
69
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.AspNetCore
Microsoft.AspNetCore
65
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications. When using NuGet 3.x this package requires at least version 3.4.
65
Microsoft.AspNetCore
Microsoft.AspNetCore
64
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
64
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications. When using NuGet 3.x this package requires at least version 3.4.
64

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-rc.2.25502.107 1 10/16/2025
10.0.0-rc.1.25451.107 11 09/11/2025
10.0.0-preview.7.25380.108 11 08/14/2025
10.0.0-preview.6.25358.103 11 07/16/2025
10.0.0-preview.5.25277.114 13 06/14/2025
10.0.0-preview.4.25258.110 18 05/17/2025
10.0.0-preview.3.25171.5 21 04/12/2025
10.0.0-preview.2.25163.2 26 03/20/2025
10.0.0-preview.1.25080.5 27 03/01/2025
9.0.10 1 10/16/2025
9.0.9 8 09/11/2025
9.0.8 9 08/07/2025
9.0.7 14 07/10/2025
9.0.6 21 06/12/2025
9.0.5 18 05/17/2025
9.0.4 20 04/10/2025
9.0.3 23 03/14/2025
9.0.2 23 02/15/2025
9.0.1 29 01/20/2025
9.0.0 37 11/17/2024
9.0.0-rc.2.24473.5 33 10/15/2024
9.0.0-rc.1.24431.7 38 09/12/2024
9.0.0-preview.7.24405.7 42 08/14/2024
9.0.0-preview.6.24327.7 40 07/11/2024
9.0.0-preview.5.24306.7 50 06/15/2024
9.0.0-preview.4.24266.19 37 05/23/2024
9.0.0-preview.3.24172.9 41 04/13/2024
9.0.0-preview.2.24128.5 49 03/14/2024
9.0.0-preview.1.24080.9 43 03/08/2024
8.0.1 46 10/09/2024
8.0.0 2,466 11/14/2023
8.0.0-rc.2.23479.6 56 10/24/2023
8.0.0-rc.1.23419.4 41 09/16/2023
8.0.0-preview.7.23375.6 40 09/03/2023
8.0.0-preview.6.23329.7 54 07/20/2023
8.0.0-preview.5.23280.8 59 07/12/2023
8.0.0-preview.4.23259.5 55 06/28/2023
8.0.0-preview.3.23174.8 48 06/29/2023
8.0.0-preview.2.23128.3 52 07/13/2023
8.0.0-preview.1.23110.8 56 02/27/2023
7.0.0 52 05/07/2023
7.0.0-rc.2.22472.3 59 07/24/2023
7.0.0-rc.1.22426.10 53 05/01/2023
7.0.0-preview.7.22375.6 57 04/30/2023
7.0.0-preview.6.22324.4 52 10/07/2022
7.0.0-preview.5.22301.12 52 07/17/2023
7.0.0-preview.4.22229.4 62 05/27/2023
7.0.0-preview.3.22175.4 53 07/16/2023
7.0.0-preview.2.22152.2 49 06/13/2023
7.0.0-preview.1.22076.8 51 04/24/2023
6.0.2-mauipre.1.22102.15 56 05/21/2023
6.0.2-mauipre.1.22054.8 50 06/24/2023
6.0.1 34 11/17/2024
6.0.0 2,463 12/07/2021
6.0.0-rc.2.21480.5 46 07/20/2023
6.0.0-rc.1.21451.13 51 08/11/2023
6.0.0-preview.7.21377.19 59 12/20/2021
6.0.0-preview.6.21352.12 38 12/20/2021
6.0.0-preview.5.21301.5 55 05/18/2023
6.0.0-preview.4.21253.7 43 07/19/2023
6.0.0-preview.3.21201.4 47 05/15/2023
6.0.0-preview.2.21154.6 44 07/05/2023
6.0.0-preview.1.21102.12 50 05/17/2023
5.0.0 48 01/27/2023
5.0.0-rc.2.20475.5 48 05/31/2023
5.0.0-rc.1.20451.14 48 05/13/2023
5.0.0-preview.8.20407.11 46 09/10/2022
5.0.0-preview.7.20364.11 52 01/06/2023
5.0.0-preview.6.20305.6 50 08/28/2022
5.0.0-preview.5.20278.1 49 05/15/2023
5.0.0-preview.4.20251.6 62 05/23/2023
5.0.0-preview.3.20215.2 46 05/15/2023
5.0.0-preview.2.20160.3 47 05/19/2023
5.0.0-preview.1.20120.4 56 06/05/2023
3.1.32 51 03/01/2023
3.1.31 47 05/10/2023
3.1.30 50 02/04/2023
3.1.29 49 11/10/2022
3.1.28 57 03/22/2023
3.1.27 52 03/28/2023
3.1.26 47 04/30/2023
3.1.25 50 05/21/2023
3.1.24 64 10/26/2022
3.1.23 54 03/24/2023
3.1.22 51 05/05/2023
3.1.21 50 10/02/2022
3.1.20 45 05/12/2023
3.1.19 55 03/22/2023
3.1.18 44 02/16/2023
3.1.17 51 05/08/2023
3.1.16 53 03/31/2023
3.1.15 54 04/17/2023
3.1.14 55 12/03/2022
3.1.13 51 02/27/2023
3.1.12 60 03/21/2021
3.1.11 59 06/11/2022
3.1.10 50 02/05/2023
3.1.9 49 01/28/2023
3.1.8 51 01/09/2023
3.1.7 50 11/09/2020
3.1.6 46 04/13/2023
3.1.5 52 03/07/2023
3.1.4 53 01/10/2023
3.1.3 50 08/27/2022
3.1.2 47 01/14/2023
3.1.1 47 02/07/2023
3.1.0 52 10/19/2022
3.1.0-preview3.19553.2 47 07/24/2023
3.1.0-preview2.19525.4 51 07/24/2023
3.1.0-preview1.19506.1 44 05/06/2023
3.0.3 49 02/05/2023
3.0.2 58 01/25/2023
3.0.1 49 02/11/2023
3.0.0 58 12/20/2021
3.0.0-rc1.19456.10 48 05/11/2023
3.0.0-preview9.19423.4 47 11/21/2022
3.0.0-preview8.19405.4 54 04/22/2023
3.0.0-preview7.19362.4 55 05/12/2023
3.0.0-preview6.19304.6 58 10/20/2022
3.0.0-preview5.19227.9 50 05/15/2023
3.0.0-preview4.19216.2 48 11/05/2022
3.0.0-preview3.19153.1 56 04/26/2023
3.0.0-preview.19074.2 47 07/18/2023
3.0.0-preview.18572.1 49 05/10/2023
2.2.0 55 12/20/2021
2.2.0-preview3-35497 55 01/21/2023
2.2.0-preview2-35157 50 05/19/2023
2.2.0-preview1-35029 48 01/29/2023
2.1.1 52 01/14/2023
2.1.0 46 01/19/2023
2.1.0-rc1-final 50 02/20/2023
2.1.0-preview2-final 50 02/01/2023
2.1.0-preview1-final 64 12/10/2022
2.0.2 44 03/22/2023
2.0.1 66 12/20/2021
2.0.0 53 06/07/2022
2.0.0-preview2-final 58 03/17/2023
2.0.0-preview1-final 53 04/01/2023
1.1.2 50 10/15/2022
1.1.1 52 02/13/2023
1.1.0 53 12/20/2021
1.1.0-preview1-final 49 04/16/2023
1.0.2 49 10/02/2022
1.0.1 51 12/20/2021
1.0.0 52 12/20/2021
1.0.0-rc2-final 44 02/18/2023
1.0.0-rc1-final 51 01/22/2023