Commit e2d44293 by zry

bug

parent 6c529f59
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NLog.Web;
namespace Performance.Api namespace Performance.Api
{ {
...@@ -19,6 +20,13 @@ public static void Main(string[] args) ...@@ -19,6 +20,13 @@ public static void Main(string[] args)
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args) WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((context, config) =>
{
var env = context.HostingEnvironment;
env.ConfigureNLog("nlog.config");
config.AddJsonFile("appsettings.json", true, true);
config.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true);
})
.UseStartup<Startup>(); .UseStartup<Startup>();
} }
} }
...@@ -94,17 +94,9 @@ public void ConfigureServices(IServiceCollection services) ...@@ -94,17 +94,9 @@ public void ConfigureServices(IServiceCollection services)
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILoggingBuilder builder) public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{ {
env.ConfigureNLog("nlog.config"); loggerFactory.AddNLog();
builder.AddConsole(configure =>
{
configure.IncludeScopes = true;
});
builder.AddNLog(new NLogProviderOptions
{
IncludeScopes = true
});
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment