Reputation: 453
How can I use Serilog from Controller itself? I have added this in my Configure
method in Startup
class :
var serilog = new Serilog.LoggerConfiguration().MinimumLevel.Debug().WriteTo.File("C:/Temp/log.txt");
logFact.AddSerilog(serilog);
I also tried something like this:
public PeopleController(ILoggerFactory logFact)
{
_loger = logFact.CreateLogger<PeopleController>();
}
And after that in action method I wanted to call it like this:
_loger.LogDebug("this is my custom logges");
Issue is that I don't get my log written in my log.txt
file. How should I do this properly?
Upvotes: 1
Views: 2109
Reputation: 836
Try some other level than Debug, I've got Serilog working except for the Debug level, not sure if its a bug or a config issue.
Upvotes: 3