Today at work I was asked to add some basic logging functionality in my existing ASP.NET MVC (not Core) project. I was told to use Serilog for this.
However, I failed to find any reasonable example of using Serilog in MVC, all links simply refer to Core. I tried to do everything myself. After installing all necessary packages (Serilog, Serilog.Sinks.File), I created a "Logs" folder and tried this:
var log = new LoggerConfiguration()
.WriteTo.File("~/Logs/log.txt")
.CreateLogger();
log.Information("Hello from Serilog!");
I expected to see a new file in the folder but there wasn't any. I also tried using a simpler path "log.txt" and creating a file in this folder preemptively but it didn't help.
Is it possible that Serilog is not supported for MVC at all? If it is, what is a simple way to log something into a text file?