'Logging not outputing anything
I am trying to use logging for a c# console project. Every resource online seems to be for asp.net and using appsettings.json which is something that my project doesn't seem to have so I expect it is something asp.net related. I found a video using the following example for logging.
using Microsoft.Extensions.Logging;
namespace ConsoleTesting;
internal class Program
{
public static void Main()
{
var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddConsole();
});
var logger = loggerFactory.CreateLogger("Logger");
logger.LogCritical("Critical");
logger.LogDebug("Debug");
logger.LogInformation("Information");
Console.WriteLine("Hello World!");
}
}
But this doesn't print anything in the console apart from Hello World.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
