// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseCors("CorsPolicy"); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/AssetManagementV1/swagger.json", "Asset Management V1"); //c.RoutePrefix = String.Empty; }); var all = Assembly .GetEntryAssembly() .GetReferencedAssemblies() .Select(Assembly.Load) .SelectMany(x => x.DefinedTypes) .Where(type => typeof(ControllerBase).GetTypeInfo().IsAssignableFrom(type.AsType())).Select(x => x.Assembly).ToList(); foreach (var item in all) { LogFourNet.SetUp(item, "log4net.config"); } app.UseHttpsRedirection(); app.UseMvc(); }
// GET api/values public ValuesController() { LogFourNet.SetUp(Assembly.GetEntryAssembly(), "log4net.config"); }