bar*_*317 3 logging azure azure-application-insights azure-functions
我有一个带有 AzureFunctionVersion v3 的 Azure Function,一段时间以来,我在 Application Insights 或 Rider Console 中看不到任何未记录在 FunctionTrigger 本身中的日志。
[FunctionName("test")]
public IActionResult Test([HttpTrigger(AuthorizationLevel.Function, "delete", Route = BasePath + "/{roomId}")] HttpRequest req,
ILogger log)
{
log.LogInformation("Log is shown");
myservice.DoIt();
}
Run Code Online (Sandbox Code Playgroud)
namespace MyApp.Test.Service {
public MyService(ILoggerFactory loggerFactory)
{
_log = loggerFactory.CreateLogger(GetType().Namespace);
}
public void DoIt() {
_log.LogInformation("Log is not shown");
}
}
Run Code Online (Sandbox Code Playgroud)
我的 host.json 看起来像:
"logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": false
}
},
"logLevel": {
"MyApp.*": "Information"
}
}
Run Code Online (Sandbox Code Playgroud)
logLevel请尝试通过以下方式之一进行更改:
"logLevel": {"MyApp": "Information"}
"logLevel": { "Default": "Information" }
| 归档时间: |
|
| 查看次数: |
2052 次 |
| 最近记录: |