When func.exe is run from VS, it suggests "For detailed output, run func with --verbose flag."

问题描述

在本地调式Azure Function时候,默认输出的日志都是比较简洁的。如果需要详细的日志输出,可以在启动func命令中添加--verbose参数。那如何来添加呢?

日志输出对比:

开启前日志 开启后日志
Hosting environment: Production
Content root path: /home/pont/projects/fibre-collective/packages/certification
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Value cannot be null. (Parameter 'provider')
Azure Functions Core Tools (3.0.2358 Commit hash: d6d66f19ea30fda5fbfe068fc22bc126f0a74168)
Function Runtime Version: 3.0.13159.0
[5/19/2020 12:09:26 PM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:python
[5/19/2020 12:09:26 PM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:java
[5/19/2020 12:09:26 PM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:powershell
[5/19/2020 12:09:26 PM] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '190e8a62-6b3e-48f1-83d1-a3ede0bce239'
[5/19/2020 12:09:26 PM] Reading host configuration file '/home/pont/projects/fibre-collective/packages/certification/host.json'
[5/19/2020 12:09:26 PM] Host configuration file read:
[5/19/2020 12:09:26 PM] {
[5/19/2020 12:09:26 PM] "version": "2.0",
[5/19/2020 12:09:26 PM] "logging": {
[5/19/2020 12:09:26 PM] "applicationInsights": {
[5/19/2020 12:09:26 PM] "samplingExcludedTypes": "Request",
[5/19/2020 12:09:26 PM] "samplingSettings": {
[5/19/2020 12:09:26 PM] "isEnabled": true
[5/19/2020 12:09:26 PM] }
[5/19/2020 12:09:26 PM] }
[5/19/2020 12:09:26 PM] },
[5/19/2020 12:09:26 PM] "extensionBundle": {
[5/19/2020 12:09:26 PM] "id": "Microsoft.Azure.Functions.ExtensionBundle",
[5/19/2020 12:09:26 PM] "version": "[1.*, 2.0.0)"
[5/19/2020 12:09:26 PM] }
[5/19/2020 12:09:26 PM] }
[5/19/2020 12:09:26 PM] Reading functions metadata
[5/19/2020 12:09:26 PM] 1 functions found
[5/19/2020 12:09:26 PM] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /tmp/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[5/19/2020 12:09:26 PM] Fetching information on versions of extension bundle Microsoft.Azure.Functions.ExtensionBundle available on https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/index.json
[5/19/2020 12:09:27 PM] Downloading extension bundle from https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/1.1.1/Microsoft.Azure.Functions.ExtensionBundle.1.1.1.zip to /tmp/d87a8cf9-a864-42f0-a891-b7e41a7d103d/Microsoft.Azure.Functions.ExtensionBundle.1.1.1.zip
Hosting environment: Production
Content root path: /home/pont/projects/fibre-collective/packages/certification
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
[5/19/2020 12:11:22 PM] Executing HTTP request: {
[5/19/2020 12:11:22 PM] "requestId": "90571ec9-f3f7-4606-b012-62097466c9a3",
[5/19/2020 12:11:22 PM] "method": "GET",
[5/19/2020 12:11:22 PM] "uri": "/"
[5/19/2020 12:11:22 PM] }
System.ArgumentNullException: Value cannot be null. (Parameter 'provider')
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Azure.Functions.Cli.Actions.HostActions.StartHostAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\HostActions\StartHostAction.cs:line 252
at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 66
Application is shutting down...
[5/19/2020 12:11:45 PM] Stopping host...
[5/19/2020 12:11:45 PM] Host shutdown completed.

开启方式

方式一:在VS Code中修改.vscode\launch.json文件中的启动命令

默认通过VS Code创建一个Java Azure Function的文件目录结构为:

PS C:\Function>  tree /f
Folder PATH listing for volume OSDisk
Volume serial number is 4A75-5D11
C:.
│ .classpath
│ .gitignore
│ .project
│ host.json
│ local.settings.json
│ pom.xml

├───.settings
│ org.eclipse.core.resources.prefs
│ org.eclipse.jdt.apt.core.prefs
│ org.eclipse.jdt.core.prefs
│ org.eclipse.m2e.core.prefs

├───.vscode
│ extensions.json
│ launch.json
│ settings.json
│ tasks.json

├───src
│ ├───main
│ │ └───java
│ │ └───com
│ │ └───function
│ │ Function.java
│ │
│ └───test
│ └───java
│ └───com
│ └───function
│ FunctionTest.java
│ HttpResponseMessageMock.java

在launch.json文件中,添加启动参数 --verbose

{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Java Functions",
"type": "java",
"request": "attach",
"hostName": "127.0.0.1",
"port": 5005,
"preLaunchTask": "func: host start --verbose"
}
]
}

点击F5,从VS Code中启动Azure Function,根据提示,在tasks.json也需要添加--verbose参数

{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"command": "host start --verbose",
"problemMatcher": "$func-java-watch",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/target/azure-functions/myFunction-0115"
},
"dependsOn": "package"
},
{
"label": "package",
"command": "mvn clean package",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

方式二:直接通过命令行启动Azure Funciton,使用完整命令: func host --verbose

PS C:\Function> func  start --verbose

效果展示:

参考资料:

Value cannot be null. (Parameter 'provider')https://github.com/Azure/azure-functions-core-tools/issues/2232

在 Azure 中使用 Visual Studio Code 创建 Java 函数https://docs.azure.cn/zh-cn/azure-functions/create-first-function-vs-code-java

【Azure Function】开启Azure Function输出详细Debug日志 ( --verbose)的更多相关文章

  1. 【Azure 应用服务】Azure Function HTTP 触发后, 230秒就超时。而其他方式触发的Function, 执行5分钟后也超时,如何调整超时时间?

    问题描述 Azure Function HTTP 触发后, 230秒就超时,而其他方式触发的Function, 执行5分钟后也超时,如何调整超时时间? 问题分析 查阅官方文档,对函数应用超时持续时间有 ...

  2. Azure - Create your first function using Visual Studio

    Azure Functions lets you execute your code in a serverless environment without having to first creat ...

  3. 【Azure 应用服务】Azure Function集成虚拟网络,设置被同在虚拟网络中的Storage Account触发,遇见Function无法触发的问题

    一切为了安全,所有的云上资源如支持内网资源访问,则都可以加入虚拟网络 问题描述 使用Azure Function处理Storage Account中Blob 新增,更新,删除等情况.Storage A ...

  4. 【Azure 应用服务】Azure Function 启用 Managed Identity后, Powershell Funciton出现 ERROR: ManagedIdentityCredential authentication failed

    问题描述 编写Powershell Function,登录到China Azure并获取Azure AD User信息,但是发现遇见了 [Error] ERROR: ManagedIdentityCr ...

  5. 【Azure Developer】在Github Action中使用Azure/functions-container-action@v1配置Function App并成功部署Function Image

    问题描述 使用Github Action,通过 Azure/functions-container-action@v1 插件来完成 yaml 文件的配置,并成功部署Function Image 的过程 ...

  6. Azure VM开启资源监控

    目前China的Azure VM资源监控默认是不打开的.本文将介绍如何开启VM的监控功能. 一 Azure VM 打开Azure的Portal页面https://portal.azure.cn,登录后 ...

  7. 使用 Azure CLI 在 Azure China Cloud 云平台上手动部署一套 Cloud Foundry

    这篇文章将介绍如何使用 Azure CLI 在 Azure China Cloud 云平台上手动部署一套 Cloud Foundry.本文的目的在于: 了解作为 PaaS 的 Cloud Foundr ...

  8. Azure资源管理工具Azure PowerShell介绍

    什么是 Azure PowerShell? Azure PowerShell 是一组模块,提供用于通过 Windows PowerShell 管理 Azure 的 cmdlet.你可以使用 cmdle ...

  9. 【Azure Redis 缓存 Azure Cache For Redis】Azure Redis由低级别(C)升级到高级别(P)的步骤和注意事项, 及对用户现有应用的潜在影响,是否需要停机时间窗口,以及这个时间窗口需要多少的预估问题

    问题描述 由于Azure Redis的性能在不同级别表现不同,当需要升级/缩放Redis的时候,从使用者的角度,需要知道有那些步骤? 注意事项? 潜在影响?停机事件窗口? 升级预估时间? 解决方案 从 ...

  10. Windows Azure HandBook (2) Azure China提供的服务

    <Windows Azure Platform 系列文章目录> 对于传统的自建数据中心,从底层的Network,Storage,Servers,Virtualization,中间层的OS, ...

随机推荐

  1. postman中monitor的使用

    monitor就是一个摸鱼的功能,我们把写好的接口部署到postman的web服务器中, 绑定自己的邮箱,运行结果会发送到自己的邮箱中,不用实时监控,是个非常方便 的功能(不安全) 1.crete a ...

  2. Pdfium.Net.Free 一个免费的Pdfium的 .net包装器--PDF预览器框选

    项目地址: Pdfium.Net:https://github.com/1000374/Pdfium.Net PdfiumViewer:https://github.com/1000374/Pdfiu ...

  3. PCIe诞生20年来最大变革!引入光学传输

    PCI-SIG组织官方宣布,已经成立新的光学工作组(Optical Workgroup),研究为PCIe规范引入光学传输接口的可能性. PCIe标准是Intel 2001年提出的,2003年发布1.0 ...

  4. 在Spring Cloud 2020中使用Consul配置中心遇到的问题

    升级Spring Cloud 2020后发现Consul配置中心失效了,配置中心的配置和bootstrap.yml中的配置都没有生效. 话不多说,先看官方文档:https://docs.spring. ...

  5. Laravel日期处理

    1. 常用: echo Carbon::now(); // 2023-04-08 18:07:24 echo Carbon::today(); // 2023-04-08 00:00:00 echo ...

  6. 深入浅出Java多线程(六):Java内存模型

    引言 大家好,我是你们的老伙计秀才!今天带来的是[深入浅出Java多线程]系列的第六篇内容:Java内存模型.大家觉得有用请点赞,喜欢请关注!秀才在此谢过大家了!!! 在并发编程中,有两个关键问题至关 ...

  7. docker容器-乌班图安装vim

    apt-get update && apt-get install -y vim

  8. 域名解析迟迟不生效,刷新本地DNS的方法

    ipconfig /flushdns 刷新后,再ping  发生域名解析 的指向就对了.!

  9. 实现阿里云模型服务灵积 DashScope 的 Semantic Kernel Connector

    Semantic Kernel 内置的 IChatCompletionService 实现只支持 OpenAI 与 Azure OpenAI,而我却打算结合 DashScope(阿里云模型服务灵积) ...

  10. CF1348

    传送门 A: 一个组 \(2^n+2^1+\dots+2^{\frac{n}{2}-1}\),另一个组剩下的. B: 考虑不停循环. 如果不同的数字超过 \(k\),无解. 否则先把原序列去重,然后把 ...