Microsoft.Extensions.Logging.Console 11.0.0-rc.1.26425.128

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
22
Microsoft.AspNetCore
Microsoft.AspNetCore
28
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
20
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/2b7e994b8a304700a09617ffc5052f0d943bbcba
19
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/bd1e14b7d16b798de8a874189c89afed755a266c
19
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/c3acdcac86dad91c3d3fbc3b93ecc6b7ba494bdc
19
Microsoft.AspNetCore.SignalR.Client
Client for ASP.NET Core SignalR
20
Microsoft.AspNetCore.SignalR.Client
Client for ASP.NET Core SignalR
21
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
19
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
20
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
37
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
42
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
46
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications. When using NuGet 3.x this package requires at least version 3.4.
19
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
19
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
20
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
22

.NET 10.0

.NET 11.0

.NET Framework 4.6.2

.NET Standard 2.0

Version Downloads Last updated
11.0.0-rc.1.26425.128 3 12.09.2026
11.0.0-preview.7.26381.103 6 22.08.2026
11.0.0-preview.6.26359.118 5 21.07.2026
11.0.0-preview.5.26302.115 10 13.06.2026
11.0.0-preview.4.26230.115 8 17.05.2026
11.0.0-preview.3.26207.106 5 27.04.2026
11.0.0-preview.2.26159.112 7 14.03.2026
11.0.0-preview.1.26104.118 7 12.02.2026
10.0.12 2 12.09.2026
10.0.11 2 22.08.2026
10.0.10 4 21.07.2026
10.0.9 12 13.06.2026
10.0.8 8 17.05.2026
10.0.7 10 27.04.2026
10.0.6 10 27.04.2026
10.0.5 11 14.03.2026
10.0.4 7 14.03.2026
10.0.3 8 12.02.2026
10.0.2 10 22.01.2026
10.0.1 10 19.12.2025
10.0.0 11 19.12.2025
10.0.0-rc.2.25502.107 9 18.12.2025
10.0.0-rc.1.25451.107 11 18.12.2025
10.0.0-preview.7.25380.108 10 21.08.2025
10.0.0-preview.6.25358.103 9 06.08.2025
10.0.0-preview.5.25277.114 15 09.06.2025
10.0.0-preview.4.25258.110 17 23.05.2025
10.0.0-preview.3.25171.5 15 24.05.2025
10.0.0-preview.2.25163.2 15 27.03.2025
10.0.0-preview.1.25080.5 16 06.03.2025
9.0.20 2 12.09.2026
9.0.19 4 13.08.2026
9.0.18 6 21.07.2026
9.0.17 10 12.06.2026
9.0.16 8 17.05.2026
9.0.15 10 27.04.2026
9.0.14 19 14.03.2026
9.0.13 8 12.02.2026
9.0.12 12 22.01.2026
9.0.11 9 19.12.2025
9.0.10 8 19.12.2025
9.0.9 13 16.09.2025
9.0.8 18 21.08.2025
9.0.7 13 05.08.2025
9.0.6 16 22.06.2025
9.0.5 18 24.05.2025
9.0.4 18 24.05.2025
9.0.3 20 12.03.2025
9.0.2 21 20.02.2025
9.0.1 22 17.01.2025
9.0.0 37 30.12.2024
9.0.0-rc.2.24473.5 18 23.01.2025
9.0.0-rc.1.24431.7 15 01.01.2025
9.0.0-preview.7.24405.7 15 02.01.2025
9.0.0-preview.6.24327.7 16 26.07.2024
9.0.0-preview.5.24306.7 15 27.07.2024
9.0.0-preview.4.24266.19 19 20.07.2024
9.0.0-preview.3.24172.9 18 24.07.2024
9.0.0-preview.2.24128.5 16 27.07.2024
9.0.0-preview.1.24080.9 17 16.07.2024
8.0.1 38 15.11.2024
8.0.0 43 02.07.2024
8.0.0-rc.2.23479.6 17 30.07.2024
8.0.0-rc.1.23419.4 18 15.07.2024
8.0.0-preview.7.23375.6 17 01.01.2025
8.0.0-preview.6.23329.7 18 23.07.2024
8.0.0-preview.5.23280.8 17 04.07.2024
8.0.0-preview.4.23259.5 17 17.07.2024
8.0.0-preview.3.23174.8 18 27.07.2024
8.0.0-preview.2.23128.3 18 04.07.2024
8.0.0-preview.1.23110.8 17 04.07.2024
7.0.0 21 01.01.2025
7.0.0-rc.2.22472.3 14 27.07.2024
7.0.0-rc.1.22426.10 18 21.07.2024
7.0.0-preview.7.22375.6 15 25.07.2024
7.0.0-preview.6.22324.4 17 19.07.2024
7.0.0-preview.5.22301.12 17 04.07.2024
7.0.0-preview.4.22229.4 14 01.01.2025
7.0.0-preview.3.22175.4 18 26.07.2024
7.0.0-preview.2.22152.2 17 27.07.2024
7.0.0-preview.1.22076.8 18 24.07.2024
6.0.1 21 01.01.2025
6.0.0 24 20.07.2024
6.0.0-rc.2.21480.5 17 21.07.2024
6.0.0-rc.1.21451.13 15 01.01.2025
6.0.0-preview.7.21377.19 17 01.01.2025
6.0.0-preview.6.21352.12 18 15.07.2024
6.0.0-preview.5.21301.5 15 21.07.2024
6.0.0-preview.4.21253.7 18 31.12.2024
6.0.0-preview.3.21201.4 18 26.07.2024
6.0.0-preview.2.21154.6 20 17.07.2024
6.0.0-preview.1.21102.12 17 18.07.2024
5.0.0 25 01.08.2024
5.0.0-rc.2.20475.5 17 01.01.2025
5.0.0-rc.1.20451.14 15 31.12.2024
5.0.0-preview.8.20407.11 17 31.12.2024
5.0.0-preview.7.20364.11 18 16.07.2024
5.0.0-preview.6.20305.6 16 01.01.2025
5.0.0-preview.5.20278.1 18 16.07.2024
5.0.0-preview.4.20251.6 14 31.12.2024
5.0.0-preview.3.20215.2 17 15.07.2024
5.0.0-preview.2.20160.3 15 01.01.2025
5.0.0-preview.1.20120.4 16 01.01.2025
3.1.32 18 17.07.2024
3.1.31 17 20.07.2024
3.1.30 17 02.01.2025
3.1.29 18 20.07.2024
3.1.28 18 01.01.2025
3.1.27 20 27.07.2024
3.1.26 18 30.07.2024
3.1.25 16 31.12.2024
3.1.24 18 02.01.2025
3.1.23 20 26.07.2024
3.1.22 16 31.12.2024
3.1.21 18 31.07.2024
3.1.20 21 20.07.2024
3.1.19 16 31.12.2024
3.1.18 20 26.07.2024
3.1.17 18 04.07.2024
3.1.16 18 15.07.2024
3.1.15 15 31.12.2024
3.1.14 17 04.07.2024
3.1.13 18 01.01.2025
3.1.12 19 27.07.2024
3.1.11 19 22.07.2024
3.1.10 20 04.07.2024
3.1.9 23 18.07.2024
3.1.8 23 04.07.2024
3.1.7 23 21.07.2024
3.1.6 23 04.07.2024
3.1.5 21 31.12.2024
3.1.4 24 27.07.2024
3.1.3 22 26.07.2024
3.1.2 23 24.07.2024
3.1.1 21 31.12.2024
3.1.0 23 31.12.2024
3.1.0-preview3.19553.2 18 24.07.2024
3.1.0-preview2.19525.4 15 01.01.2025
3.1.0-preview1.19506.1 18 29.07.2024
3.0.3 22 30.07.2024
3.0.2 20 24.07.2024
3.0.1 23 16.07.2024
3.0.0 21 21.07.2024
3.0.0-rc1.19456.10 16 04.07.2024
3.0.0-preview9.19423.4 13 01.01.2025
3.0.0-preview8.19405.4 15 01.01.2025
3.0.0-preview7.19362.4 17 24.07.2024
3.0.0-preview6.19304.6 16 04.07.2024
3.0.0-preview5.19227.9 17 26.07.2024
3.0.0-preview4.19216.2 17 17.07.2024
3.0.0-preview3.19153.1 20 04.07.2024
3.0.0-preview.19074.2 15 04.07.2024
3.0.0-preview.18572.1 16 26.07.2024
2.2.0 22 31.12.2024
2.2.0-preview3-35497 18 27.07.2024
2.2.0-preview2-35157 16 01.01.2025
2.2.0-preview1-35029 16 18.02.2025
2.1.1 20 01.01.2025
2.1.0 20 01.01.2025
2.1.0-rc1-final 18 04.07.2024
2.1.0-preview2-final 17 01.01.2025
2.1.0-preview1-final 18 04.07.2024
2.0.2 23 04.07.2024
2.0.1 22 04.07.2024
2.0.0 19 25.07.2024
2.0.0-preview2-final 17 01.01.2025
2.0.0-preview1-final 16 01.01.2025
1.1.2 22 28.07.2024
1.1.1 23 04.07.2024
1.1.0 21 01.01.2025
1.1.0-preview1-final 19 04.07.2024
1.0.2 21 04.07.2024
1.0.1 21 31.12.2024
1.0.0 22 19.07.2024
1.0.0-rc2-final 18 04.07.2024
1.0.0-rc1-final 20 04.07.2024