예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .Enrich.FromLogContext()
                         .WriteTo.RollingFile("logs/" + ApplicationName + "_log_{Date}.log")
                         .WriteTo.Seq("http://bhm-svc01.adtrav.com:5341")
                         .CreateLogger()
                         .ForContext("ApplicationName", ApplicationName)
                         .ForContext("Environment", env.EnvironmentName);

            app.UseGlobalExceptionHandling(loggerFactory);

            if (env.IsDevelopment() || env.IsClone())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.AddApplicationBuilderCollection(ApplicationName, ApplicationVersion);
        }