[英]Azure Function-App is not logging to console or AppInsights
我有一個帶有 AzureFunctionVersion v3 的 Azure Function,一段時間以來,我在 Application Insights 或 Rider 控制台中看不到任何未記錄在 FunctionTrigger 本身中的日志。
[FunctionName("test")]
public IActionResult Test([HttpTrigger(AuthorizationLevel.Function, "delete", Route = BasePath + "/{roomId}")] HttpRequest req,
ILogger log)
{
log.LogInformation("Log is shown");
myservice.DoIt();
}
namespace MyApp.Test.Service {
public MyService(ILoggerFactory loggerFactory)
{
_log = loggerFactory.CreateLogger(GetType().Namespace);
}
public void DoIt() {
_log.LogInformation("Log is not shown");
}
}
我的 host.json 看起來像:
"logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": false
}
},
"logLevel": {
"MyApp.*": "Information"
}
}
請嘗試通過以下方式之一更改logLevel
:
"logLevel": {"MyApp": "Information"}
"logLevel": { "Default": "Information" }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.