Message 1 of 2
Get Appsettings not app.config ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi !
I want to setup a logging service with Configuration file. With Microsoft we must used inject dependency...
To do that I need "Getsection" in the AppSettings.json.
I follow this page : here
ServicesBuilder :
services.AddLogging(loggingBuilder =>
{
loggingBuilder.CodeFileLogger(options =>
{
Configuration.GetSection("Logging").GetSection("CodeFile").GetSection("Options")
.Bind(options);
});
});AppSettings :
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
},
"CodeFile": {
"Options": {
"FolderPath": "Logs",
"FilePath": "log_{date}.log"
},
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information",
"LicenceManager.API.Controllers.Controllers": "Information",
"LicenceManager.API.Controllers.Services": "Information"
}
}
}
}
Thx !
Developer Advocacy and Support,