简体   繁体   中英

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

 # 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?

Thanks @Dilly B, I have reproduced in my environment and got expected results as below:

Firstly, I have used Write-Host and Ouput is displayed in Output Screen as below:

在此处输入图像描述

Then I have used Write-Output and got logs of it as below:

在此处输入图像描述

Output in logs:

在此处输入图像描述

Edit:

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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