簡體   English   中英

在“代碼+測試”中運行Azure中的PowerShell時在日志中看不到write-host output

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

我在 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"

為什么我可以在底部的日志中看到“”PowerShell timer trigger function ran?”?

感謝@Dilly B,我已經在我的環境中重現並得到如下預期結果:

首先,我使用了Write-Host並且 Ouput 顯示在 Output 屏幕中,如下所示:

在此處輸入圖像描述

然后我使用了Write-Output並得到了如下日志:

在此處輸入圖像描述

Output 在日志中:

在此處輸入圖像描述

編輯:

在此處輸入圖像描述

在此處輸入圖像描述

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM