I am trying to understand why my application does not log the same number of informations when executed from visual studio and/or under IIS.
This is my startup code (constructor) related to logging:
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration( Configuration )
.CreateLogger();
and then in Configure method
public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory ) {
loggerFactory.AddSerilog();
}
here finally you can find an extract of the appsettings.json configuration file
"Serilog": {
"Using": [ "Serilog.Sinks.RollingFile" ],
"MinimumLevel": {
"Default": "Verbose",
"Override": {
"Microsoft": "Error",
"Microsoft.AspNetCore.Identity": "Debug",
"IdentityServer4": "Verbose",
"IdentityModel": "Verbose",
"System": "Warning",
"Serilog": "Verbose"
}
},
"WriteTo": [
{
"Name": "RollingFile",
"Args": {
"pathFormat": "AppLogs/logger-{Date}.log",
"outputTemplate": "{Timestamp:o} [{Level:u3}] ({Application}/{MachineName}/{ThreadId}) {Message}{NewLine}{Exception}",
"fileSizeLimitBytes": 16384
}
},
{
"Name": "LiterateConsole"
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Properties": {
"Application": "Sample"
}
},
The log file is created but the information inside the file is not the same as the ones I can see in the console output. What does I am missing?