简体   繁体   English

在“代码+测试”中运行Azure中的PowerShell时在日志中看不到write-host output

[英]Can't see write-host output in the log when running PowerShell in Azure in "Code + Test"

I have the simple script in run.ps1我在 run.ps1 中有简单的脚本

 # Input bindings are passed in via param block.
param($Timer)
# Get the current universal time in the default string format.
$currentUTCtime = (Get-Date).ToUniversalTime()
# The 'IsPastDue' property is 'true' when the current function invocation is later than scheduled.
if ($Timer.IsPastDue) {
    Write-Host "PowerShell timer is running late!"
}
# Write an information log with the current time.
Write-host "PowerShell timer trigger function ran!"
Write-Debug "PowerShell timer trigger function ran! TIME: $currentUTCtime"

Why can I see ""PowerShell timer trigger function ran?" in the log on the bottom?为什么我可以在底部的日志中看到“”PowerShell timer trigger function ran?”?

Thanks @Dilly B, I have reproduced in my environment and got expected results as below:感谢@Dilly B,我已经在我的环境中重现并得到如下预期结果:

Firstly, I have used Write-Host and Ouput is displayed in Output Screen as below:首先,我使用了Write-Host并且 Ouput 显示在 Output 屏幕中,如下所示:

在此处输入图像描述

Then I have used Write-Output and got logs of it as below:然后我使用了Write-Output并得到了如下日志:

在此处输入图像描述

Output in logs: Output 在日志中:

在此处输入图像描述

Edit:编辑:

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM