Microsoft.Extensions.Logging.Console 9.0.1

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.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
187
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
175
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/b908e913e3befcfe241f3294509e6d9570acc07b
171
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/c04846dc66cc97f71d83a83a15437828435f5d44
170
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications. This package was built from the source at: https://github.com/aspnet/javascriptservices/tree/3265b92086cb62a98d7a486f9e8f81a77ef56afc
170
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/2e51a0b6eba74bdf02aee71944e973487937cb99
168
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/7e8bbb70b266b2fdaf0b11ec47fb3077761fb6bf
168
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/1aa50faa290ecda304507981cd01ed92651d5e34
168
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
167
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/67e04394e98d5bfa6a5684d471a72fcbe30fd587
165
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
165
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/1bf292d47ac2a0ebda07d8a3f00355dd01915ad5
165
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/0a2e366eaf4d29b24b9a98e5782a04bef573189e
164
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/d4a83b27a44c35c521600e1f30ef688c874415d4
164
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/fbe05294ac5c88be848b4d57d60cb2657874da9b
163
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
163
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
161
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/aee5e4080331553ea9dfb7fb388b6d72f715bf6a
161
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/e276c8174b8bfdeb70efceafa81c75f8badbc8db
160
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/509f6badec2f3162f0e50330cd9107e5624b379b
160

Version Downloads Last updated
11.0.0-rc.3.26522.148 8 10/27/2026
11.0.0-rc.2.26504.105 13 10/14/2026
11.0.0-rc.1.26425.128 15 9/10/2026
11.0.0-preview.7.26381.103 28 8/13/2026
11.0.0-preview.6.26359.118 28 7/17/2026
11.0.0-preview.5.26302.115 34 6/10/2026
11.0.0-preview.4.26230.115 43 5/12/2026
11.0.0-preview.3.26207.106 31 5/4/2026
11.0.0-preview.2.26159.112 45 3/12/2026
11.0.0-preview.1.26104.118 42 2/11/2026
10.0.14 7 10/27/2026
10.0.13 13 10/14/2026
10.0.12 14 9/10/2026
10.0.11 28 8/13/2026
10.0.10 28 7/16/2026
10.0.9 28 6/11/2026
10.0.8 36 5/12/2026
10.0.7 42 5/4/2026
10.0.6 31 5/4/2026
10.0.5 45 3/16/2026
10.0.4 43 3/12/2026
10.0.3 35 2/11/2026
10.0.2 42 1/15/2026
10.0.1 50 12/10/2025
10.0.0 76 11/12/2025
10.0.0-rc.2.25502.107 81 10/15/2025
10.0.0-rc.1.25451.107 80 9/10/2025
10.0.0-preview.7.25380.108 83 8/15/2025
10.0.0-preview.6.25358.103 93 7/16/2025
10.0.0-preview.5.25277.114 89 6/11/2025
10.0.0-preview.4.25258.110 88 5/15/2025
10.0.0-preview.3.25171.5 97 4/11/2025
10.0.0-preview.2.25163.2 118 3/26/2025
10.0.0-preview.1.25080.5 106 2/28/2025
9.0.22 6 10/27/2026
9.0.21 14 10/14/2026
9.0.20 16 9/10/2026
9.0.19 23 8/13/2026
9.0.18 29 7/18/2026
9.0.17 40 6/11/2026
9.0.16 36 5/12/2026
9.0.15 34 5/4/2026
9.0.14 40 3/12/2026
9.0.13 38 2/11/2026
9.0.12 44 1/17/2026
9.0.11 63 11/12/2025
9.0.10 77 10/15/2025
9.0.9 88 9/10/2025
9.0.8 94 8/5/2025
9.0.7 97 7/15/2025
9.0.6 94 6/11/2025
9.0.5 102 5/16/2025
9.0.4 120 4/9/2025
9.0.3 118 3/15/2025
9.0.2 104 2/15/2025
9.0.1 145 1/18/2025
9.0.0 118 11/13/2024
9.0.0-rc.2.24473.5 102 10/25/2024
9.0.0-rc.1.24431.7 130 9/12/2024
9.0.0-preview.7.24405.7 108 8/14/2024
9.0.0-preview.6.24327.7 110 7/10/2024
9.0.0-preview.5.24306.7 125 6/14/2024
9.0.0-preview.4.24266.19 116 5/27/2024
9.0.0-preview.3.24172.9 139 4/19/2024
9.0.0-preview.2.24128.5 103 3/16/2024
9.0.0-preview.1.24080.9 115 2/24/2024
8.0.1 123 10/15/2024
8.0.0 145 11/18/2023
8.0.0-rc.2.23479.6 131 10/28/2023
8.0.0-rc.1.23419.4 127 9/15/2023
8.0.0-preview.7.23375.6 149 8/22/2023
8.0.0-preview.6.23329.7 143 7/20/2023
8.0.0-preview.5.23280.8 121 7/17/2023
8.0.0-preview.4.23259.5 132 5/20/2023
8.0.0-preview.3.23174.8 135 5/12/2023
8.0.0-preview.2.23128.3 149 3/25/2023
8.0.0-preview.1.23110.8 138 2/23/2023
7.0.0 169 12/3/2022
7.0.0-rc.2.22472.3 152 11/12/2022
7.0.0-rc.1.22426.10 124 9/15/2022
7.0.0-preview.7.22375.6 127 9/15/2022
7.0.0-preview.6.22324.4 134 9/15/2022
7.0.0-preview.5.22301.12 149 6/26/2022
7.0.0-preview.4.22229.4 155 7/3/2022
7.0.0-preview.3.22175.4 133 7/3/2022
7.0.0-preview.2.22152.2 137 7/3/2022
7.0.0-preview.1.22076.8 156 7/3/2022
6.0.2-mauipre.1.22102.15 142 7/3/2022
6.0.2-mauipre.1.22054.8 138 7/3/2022
6.0.1 95 11/14/2024
6.0.0 141 7/3/2022
6.0.0-rc.2.21480.5 145 7/3/2022
6.0.0-rc.1.21451.13 129 7/3/2022
6.0.0-preview.7.21377.19 152 7/3/2022
6.0.0-preview.6.21352.12 134 7/3/2022
6.0.0-preview.5.21301.5 147 7/3/2022
6.0.0-preview.4.21253.7 151 7/3/2022
6.0.0-preview.3.21201.4 116 7/3/2022
6.0.0-preview.2.21154.6 140 7/3/2022
6.0.0-preview.1.21102.12 145 7/3/2022
5.0.0 125 7/3/2022
5.0.0-rc.2.20475.5 153 7/3/2022
5.0.0-rc.1.20451.14 147 7/3/2022
5.0.0-preview.8.20407.11 161 7/3/2022
5.0.0-preview.7.20364.11 146 7/3/2022
5.0.0-preview.6.20305.6 163 7/3/2022
5.0.0-preview.5.20278.1 135 7/3/2022
5.0.0-preview.4.20251.6 146 7/3/2022
5.0.0-preview.3.20215.2 135 7/3/2022
5.0.0-preview.2.20160.3 152 7/3/2022
5.0.0-preview.1.20120.4 143 7/3/2022
3.1.32 133 2/21/2023
3.1.31 140 12/3/2022
3.1.30 148 10/28/2022
3.1.29 137 9/15/2022
3.1.28 161 9/15/2022
3.1.27 136 9/15/2022
3.1.26 145 7/3/2022
3.1.25 136 7/3/2022
3.1.24 143 7/3/2022
3.1.23 147 7/3/2022
3.1.22 151 7/3/2022
3.1.21 141 7/3/2022
3.1.20 128 7/3/2022
3.1.19 148 7/3/2022
3.1.18 131 7/3/2022
3.1.17 170 7/3/2022
3.1.16 136 7/3/2022
3.1.15 139 7/3/2022
3.1.14 140 7/3/2022
3.1.13 131 7/3/2022
3.1.12 147 7/3/2022
3.1.11 142 7/3/2022
3.1.10 128 7/3/2022
3.1.9 155 7/3/2022
3.1.8 150 7/3/2022
3.1.7 147 7/3/2022
3.1.6 148 7/3/2022
3.1.5 134 7/3/2022
3.1.4 152 7/3/2022
3.1.3 121 7/3/2022
3.1.2 158 7/3/2022
3.1.1 134 7/3/2022
3.1.0 145 7/3/2022
3.1.0-preview3.19553.2 129 7/3/2022
3.1.0-preview2.19525.4 142 7/3/2022
3.1.0-preview1.19506.1 135 7/3/2022
3.0.3 130 7/3/2022
3.0.2 137 7/3/2022
3.0.1 141 7/3/2022
3.0.0 135 6/13/2022
3.0.0-rc1.19456.10 141 7/3/2022
3.0.0-preview9.19423.4 152 7/3/2022
3.0.0-preview8.19405.4 154 7/3/2022
3.0.0-preview7.19362.4 128 7/3/2022
3.0.0-preview6.19304.6 144 7/3/2022
3.0.0-preview5.19227.9 135 7/3/2022
3.0.0-preview4.19216.2 146 7/3/2022
3.0.0-preview3.19153.1 148 7/3/2022
3.0.0-preview.19074.2 169 7/3/2022
3.0.0-preview.18572.1 152 7/3/2022
2.2.0 140 7/3/2022
2.2.0-preview3-35497 134 7/3/2022
2.2.0-preview2-35157 121 7/3/2022
2.2.0-preview1-35029 119 7/3/2022
2.1.1 146 7/3/2022
2.1.0 171 7/3/2022
2.1.0-rc1-final 133 7/3/2022
2.1.0-preview2-final 128 7/3/2022
2.1.0-preview1-final 137 7/3/2022
2.0.2 128 7/3/2022
2.0.1 142 7/3/2022
2.0.0 160 7/3/2022
2.0.0-preview2-final 155 7/3/2022
2.0.0-preview1-final 143 7/3/2022
1.1.2 149 7/3/2022
1.1.1 126 7/3/2022
1.1.0 131 7/3/2022
1.1.0-preview1-final 135 7/3/2022
1.0.2 157 7/3/2022
1.0.1 141 7/3/2022
1.0.0 142 7/3/2022
1.0.0-rc2-final 127 7/3/2022
1.0.0-rc1-final 146 7/3/2022