Because Logging is now handed over to the .net core implementation, how can I add OrmLite logging (selects, update, profiling info) into .net core apps?
You need to do two things in Startup.Configure
method:
- add .NET Core logger with level debug
- redefine
LogManager.LogFactory
afterapp.UseServiceStack(new AppHost())
and pass debugEnable: true intoNetCoreLogFactory
. Here is the sample of the code
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(LogLevel.Debug);
app.UseStaticFiles();
app.UseServiceStack(new AppHost());
LogManager.LogFactory = new NetCoreLogFactory(loggerFactory, true);
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
1 Like