I am studying .Net Core 2 and I have a question. I am trying to get error in my Repository layer and only saw example in Controller. Any specific reason for this?
Here are my codes:
appsettings.json
{
"ConnectionStrings": {
"DefaultConnection": "Server=FAYOL\SQLEXPRESS;Database=Pagamento;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}
Program.cs
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
logging.AddConsole();
logging.AddDebug();
})
.Build();
ShopRepository.cs
private readonly Contexto _context;
private readonly ILogger _logger;
public LojaRepository(Contexto context, ILogger<LojaRepository> logger)
{
_context = context;
_logger = logger;
}
public void Salvar(Loja loja)
{
_logger.LogInformation("Teste de log para salvar");
}
Where do I tell the file name and where to save it?
Thank you