ASPNETCORE_ENVIRONMENT
is used for environment varialble for ASP.net core. It is convention. Instead of that, I use similar one because it is console app.??
operator can be used for default env variable.
- A file can be a placeholder for Configuration.
appsettings.json
is just conventional setting name on .net core.- Section can be selected by
Configuration.GetSection("SectionName")
.
- .net core provides default dependency injection container. So, we can utilize it.
- In this session, we can't say it is useful but just stick to it for next session.
- Dependency injection in ASP.NET Core should be useful resource.
ServiceCollection
helps us to add logging.- Lambda expressions for logging builder can be used.
- Please check
LogLevel
onappsettings.Development.json
. - You can create logger from loggerFactory.
- In
CreateLogger<Program>()
,Program
is category name. Usually class name is used. - Understanding log level is important.
- Without
((IDisposable) serviceProvider)?.Dispose();
, you can't see output at this moment. Please check here.
Next topic (maybe):
file logging with serilog