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. 学习: Linux的 date 命令

    date 命令非常好用 多用 date --h 还是非常好的 获取 今天是今年的第多少天 最简单的办法 就是 date +%j 以后需要多学习 多利用 linux的帮助才可以呢. Usage: dat ...

  2. 30岁程序媛求职路复盘:文转码+失业半年+PHP如何涨薪5K!?

    这篇文章来自一位群友的分享: 这篇文章写于下班路上,刚刚入职不久,我想再冲刺一下大厂,阳哥建议我坚持总结打卡,可以尝试写写博客. 那我就从这篇开始吧,希望开个好头! 上班的感觉真好 今天是入职的第二周 ...

  3. js-正则表达式边界符和前瞻、后顾的使用-保证你看明白

    创建正则表达式第两种方式 1==>通过new字符的方式,来创建正则表达式 2==>通过创建字面量的方式去创建 1.new字符的方式 let regexp=new RegExp(/123/) ...

  4. vue如何在render函数中使用判断(2)

    h函数的三个参数 第一个参数是必须的. 类型:{String | Object | Function} 一个 HTML 标签名.一个组件.一个异步组件.或一个函数式组件. 是要渲染的html标签. 第 ...

  5. electron-builder

    electron-builder打包工具 首先,确保你的项目中已经安装了 electron-builder.可以在项目根目录下运行以下命令来安装它: npm install electron-buil ...

  6. 3D圆饼图,可修改颜色,图片等,具体见代码:

    组件代码: <template> <!-- 饼图 --> <div :id="histogramId" v-bind:style="{hei ...

  7. 【Java】先return还是先finally

    之前调试只发现有的方法执行完return语句后再执行finally,但是没有细究 最近debug代码的时候发现,不同返回类型的方法,return和finally执行顺序竟然不一样 先看返回类型为voi ...

  8. Midjourney|文心一格prompt教程[技巧篇]:生成多样性、增加艺术风格、图片二次修改、渐进优化、权重、灯光设置等17个技巧等你来学

    Midjourney|文心一格prompt教程[技巧篇]:生成多样性.增加艺术风格.图片二次修改.渐进优化.权重.灯光设置等17个技巧等你来学 1.技巧一:临摹 我认为学习图片类的 prompt,跟学 ...

  9. 19.5 Boost Asio 传输结构体

    同步模式下的结构体传输与原生套接字实现方式完全一致,读者需要注意的是在接收参数是应该使用socket.read_some函数读取,发送参数则使用socket.write_some函数实现,对于套接字的 ...

  10. powerDesigner 逆向工程 mysql 生成 PDM

     1. 信息补充说明 powerDesigner  16.5 mysql 5.6 主要内容:使用powerDesigner的逆向工程,将mysql中的数据库转换成PDM文件 所需资源: powerDe ...