如何在不使用.Net Core中的第三方记录器的情况下登录文件? [英] How to log to a file without using third party logger in .Net Core?

查看:76
本文介绍了如何在不使用.Net Core中的第三方记录器的情况下登录文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 .NET CORE 中的第三方记录器(serilog,elmah等) 登录文件?

How to log to a file without using third party logger (serilog, elmah etc.) in .NET CORE?

public void ConfigureServices(IServiceCollection services)
{
    services.AddLogging();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    loggerFactory.AddConsole(Configuration.GetSection("Logging"));
    loggerFactory.AddDebug();
}


推荐答案

当前不包括文件记录器在框架中,但正在考虑添加一个: http://github.com/aspnet/Logging/issues / 441 。随时在github上解决这个问题。

No file logger is currently included in the framework but adding one is being considered: http://github.com/aspnet/Logging/issues/441. Feel free to upvote the issue on github.

这篇关于如何在不使用.Net Core中的第三方记录器的情况下登录文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆