public static void Main(string[] args)
        {
            ISerilogService serilogConfiguration = new SerilogService();

            Log.Logger = serilogConfiguration.SerilogConfiguration();

            try
            {
                Log.Information(InitializationConstants.WEB_HOST_STARTING);
                var host = CreateHostBuilder(args).Build();

                InitialServicesScopeFactory.Build(host);

                host.Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, InitializationConstants.WEB_HOST_TERMINATED);
            }
            finally
            {
                Log.Information(InitializationConstants.WEB_HOST_STOPPED);
                Log.CloseAndFlush();
            }
        }
        public static int Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Information()
                         .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
                         .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
                         .Enrich.FromLogContext()
                         .WriteTo.Console()
                         //.WriteTo.Seq("http://localhost:5341")
                         .CreateLogger();

            try
            {
                Log.Information("Starting web host");

                IHost host = CreateHostBuilder(args).Build();
                InitialServicesScopeFactory.Build(host);
                host.Run();

                return(0);
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
                return(1);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            Log.Logger = SerilogConfiguration.LoggerConfig();

            try
            {
                Log.Information(CommonConstants.HostStart);

                IHost host = CreateHostBuilder(args).Build();

                InitialServicesScopeFactory.Build(host);

                host.Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, CommonConstants.HostTerminate);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }