@@ -37,23 +37,16 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
3737 Host . CreateDefaultBuilder ( args )
3838 . UseWindowsService ( ) //Windows
3939 . UseSystemd ( ) //Linux
40+ . ConfigureAppConfiguration ( ( hostContext , config ) =>
41+ {
42+ config . AddJsonFile ( "appsettings.json" , optional : false , reloadOnChange : true ) ;
43+ config . AddJsonFile ( $ "appsettings.{ hostContext . HostingEnvironment . EnvironmentName } .json", optional : true , reloadOnChange : true ) ;
44+ } )
4045 . ConfigureServices ( ( hostContext , services ) =>
4146 {
4247 IConfiguration configuration = hostContext . Configuration ;
43- ILoggerFactory loggerFactory =
44- LoggerFactory . Create ( builder =>
45- {
46- builder . AddConfiguration ( configuration . GetSection ( "Logging" ) ) ;
47- builder . AddSimpleConsole ( options =>
48- {
49- options . IncludeScopes = true ;
50- options . SingleLine = true ;
51- options . TimestampFormat = "yyyy-MM-dd HH:mm:ss " ;
52- options . UseUtcTimestamp = true ;
53- } ) ;
54- } ) ;
55- services . AddSingleton ( loggerFactory ) ;
56- AppContext . SetSwitch ( "Npgsql.EnableLegacyTimestampBehavior" , true ) ;
48+ LoggingService . ConfigurarLogging ( services , configuration ) ;
49+ AppContext . SetSwitch ( "Npgsql.EnableLegacyTimestampBehavior" , true ) ;
5750 services . AddScoped ( typeof ( UtilTelemetry ) ) ;
5851 services . AddScoped ( typeof ( Usuario ) ) ;
5952 services . AddScoped ( typeof ( UtilPeticion ) ) ;
0 commit comments