Skip to content

Commit

Permalink
add logging to file
Browse files Browse the repository at this point in the history
  • Loading branch information
djpnewton committed Oct 19, 2017
1 parent 5d1ea31 commit 3132901
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using viafront3.Data;
using viafront3.Models;
using viafront3.Services;
Expand Down Expand Up @@ -40,7 +41,7 @@ public void ConfigureServices(IServiceCollection services)
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
Expand All @@ -62,6 +63,8 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});

loggerFactory.AddFile("logs/viafront-{Date}.txt");
}
}
}
1 change: 1 addition & 0 deletions viafront3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 3132901

Please sign in to comment.