C# ILogger Asp.net核心未记录日志级别“;信息“;关于iis8

C# ILogger Asp.net核心未记录日志级别“;信息“;关于iis8,c#,logging,asp.net-core-2.0,iis-8,log-level,C#,Logging,Asp.net Core 2.0,Iis 8,Log Level,我已使用IIS 8在Windows Server 2012上部署了一个Asp.net Core 2 Web应用程序 我无法将“信息”记录到日志文件中,它只记录“警告”。我已根据此链接创建了一个自定义记录器: 在本地主机上部署时,它会在上执行预期的任务。我还启用了权限,因此存在一些日志记录,例如标准日志 但是,为了保存记录,我还想存储我的其他重要日志 下面是我的日志文件的屏幕截图 代码段:在StartUp.cs中配置方法 public void Configure(IApplic

我已使用IIS 8在Windows Server 2012上部署了一个Asp.net Core 2 Web应用程序

我无法将“信息”记录到日志文件中,它只记录“警告”。我已根据此链接创建了一个自定义记录器:

在本地主机上部署时,它会在上执行预期的任务。我还启用了权限,因此存在一些日志记录,例如标准日志

但是,为了保存记录,我还想存储我的其他重要日志

下面是我的日志文件的屏幕截图 代码段:在StartUp.cs中配置方法

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, 
        ILoggerFactory loggerFactory )
    {

        app.UseSession();
        if (env.IsDevelopment())
        {
            app.UseBrowserLink();
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
        }

        loggerFactory.AddProvider(new CustomLoggerProvider(new CustomLoggerProviderConfiguration
        {
            LogLevel = LogLevel.Information
        },env.ContentRootPath));

        app.UseStaticFiles();

        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=test}/{action=test}/{id?}");
        });
    }
代码片段:实际创建文件的函数

        private void WriteToLog(string message)
    {

        ////When Date change create new file.
        string filePath = _hostingPath + "\\test\\" + "Web_" + DateTime.Today.ToString("yyyy_MM_dd") + ".txt";

        FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.Write);
        using (StreamWriter streamWriter = new StreamWriter(fs))
        {
            streamWriter.WriteLine(message);
            streamWriter.Close();
        }
    }
另外,我知道在服务器上存储日志并不是一个好的做法,因为它需要额外的空间。有没有其他方法可以建议存储日志?请告诉我


此外,如果在IIS上没有显示日志级别的“信息”,我们将非常感谢您的帮助。

您认为IIS与此有关的原因是什么?我对IIS和Asp.net Core 2没有太多问题,因此我假设这与此相同。但是,如果您有任何想法,请注意ITIS与日志记录无关。发现错误时,默认情况下它记录了所有“警告”