未登录遥测信息,以调试窗口与ASP.Net核2.0应用

问题描述:

我在Visual Studio 2017年编写ASP.NET 2.0的核心应用程序,我已经在控制器日志记录,像这样:未登录遥测信息,以调试窗口与ASP.Net核2.0应用

public HomeController(ILogger<HomeController> logger) 
    { 
     this._logger = logger; 
    } 

    public IActionResult Index() 
    { 
     _logger.LogInformation("In The Index"); 
     return View(); 
    } 

这产生

WebApplication4.Controllers.HomeController:信息:在调试窗口就好了记录在索引

不过,我想日志所有这些遥测方法:

应用洞察遥测(未配置):{ “名”: “Microsoft.ApplicationInsights.Dev.Message”, “时间”:“2017-10-09T19:11: 31.1311753Z”, “标签”:{ “ai.internal.nodeName”: “桌面MBRK754”, “ai.operation.id”: “7a80811a-422cb8019de22af6”, “ai.location.ip”: “127.0.0.1” “ai.cloud.roleInstance”: “桌面MBRK754”, “ai.operation.parentId”: “| 7a80811a-422cb8019de22af6。”, “ai.application.ver”: “1.0.0.0”,“ai.operation。名称“:”GET Home/Index“,”ai.internal.sdkVersion“:”aspnet5c:2.1.1“},”data“:{”baseType“:”MessageData“,”baseData“:{”ver“:2 ,“message”:“执行操作方法WebApplication4.Controllers.HomeController.Index(WebApplication4)with arguments((null)) - ModelState is Valid”,“severityLevel”:“Information”,“properties”:{“AspNetCoreEnvironment”:“杰韦利opment“,”ValidationState“:”Valid“,”ActionName“:”WebApplication4.Controllers.HomeController.Index(WebApplication4)“,”CategoryName“:”Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker“,”DeveloperMode“:”true ”, “{} OriginalFormat”: “正在执行的操作方法{ActionName}与参数({}参数) - 的ModelState是{} ValidationState”}}}}

我appsettings.json看起来是这样的:

"Logging": { 
    "IncludeScopes": false, 
    "LogLevel": { 
    "Default": "Information" 
    } 
} 

如何过滤出只是的遥测消息?

+0

[在调试禁用应用见解]的可能的复制(https://*.com/questions/32057441/disable-application-insights-in-debug) –

Startup.Configure()中添加以下行Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.DisableTelemetry = true;

Sources