From ab04533261eff228f28e08900445d0edef3eb70c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:55:09 -0800 Subject: [PATCH] Support Test Proxy logging error output into a different log file (#31759) Co-authored-by: alzimmermsft <48699787+alzimmermsft@users.noreply.github.com> --- eng/common/testproxy/publish-proxy-logs.yml | 1 + eng/common/testproxy/test-proxy-standalone-tool.yml | 5 +++-- eng/common/testproxy/test-proxy-tool.yml | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/eng/common/testproxy/publish-proxy-logs.yml b/eng/common/testproxy/publish-proxy-logs.yml index 4f4d3d7f548f..746e697148d1 100644 --- a/eng/common/testproxy/publish-proxy-logs.yml +++ b/eng/common/testproxy/publish-proxy-logs.yml @@ -5,6 +5,7 @@ steps: - pwsh: | New-Item -ItemType Directory -Force "${{ parameters.rootFolder }}/proxy-logs" Copy-Item -Path "${{ parameters.rootFolder }}/test-proxy.log" -Destination "${{ parameters.rootFolder }}/proxy-logs/proxy.log" + Copy-Item -Path "${{ parameters.rootFolder }}/test-proxy-error.log" -Destination "${{ parameters.rootFolder }}/proxy-logs/proxy-error.log" displayName: Copy Log File condition: succeededOrFailed() diff --git a/eng/common/testproxy/test-proxy-standalone-tool.yml b/eng/common/testproxy/test-proxy-standalone-tool.yml index a836427ad79e..596add2b57d3 100644 --- a/eng/common/testproxy/test-proxy-standalone-tool.yml +++ b/eng/common/testproxy/test-proxy-standalone-tool.yml @@ -51,7 +51,8 @@ steps: - pwsh: | $Process = Start-Process $(PROXY_EXE) ` -ArgumentList "start -u --storage-location ${{ parameters.rootFolder }}" ` - -NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log + -NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log ` + -RedirectStandardError ${{ parameters.rootFolder }}/test-proxy-error.log Write-Host "##vso[task.setvariable variable=PROXY_PID]$($Process.Id)" displayName: 'Run the testproxy - windows' @@ -59,7 +60,7 @@ steps: # nohup does NOT continue beyond the current session if you use it within powershell - bash: | - nohup $(PROXY_EXE) &>${{ parameters.rootFolder }}/test-proxy.log & + nohup $(PROXY_EXE) 1>${{ parameters.rootFolder }}/test-proxy.log 2>${{ parameters.rootFolder }}/test-proxy-error.log & echo $! > $(Build.SourcesDirectory)/test-proxy.pid echo "##vso[task.setvariable variable=PROXY_PID]$(cat $(Build.SourcesDirectory)/test-proxy.pid)" diff --git a/eng/common/testproxy/test-proxy-tool.yml b/eng/common/testproxy/test-proxy-tool.yml index e326471025ad..db1bba2f4410 100644 --- a/eng/common/testproxy/test-proxy-tool.yml +++ b/eng/common/testproxy/test-proxy-tool.yml @@ -55,7 +55,8 @@ steps: - pwsh: | $Process = Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe ` -ArgumentList "start -u --storage-location ${{ parameters.rootFolder }}" ` - -NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log + -NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log ` + -RedirectStandardError ${{ parameters.rootFolder }}/test-proxy-error.log Write-Host "##vso[task.setvariable variable=PROXY_PID]$($Process.Id)" displayName: 'Run the testproxy - windows' @@ -65,7 +66,7 @@ steps: # nohup does NOT continue beyond the current session if you use it within powershell - bash: | - nohup $(Build.BinariesDirectory)/test-proxy/test-proxy &>${{ parameters.rootFolder }}/test-proxy.log & + nohup $(Build.BinariesDirectory)/test-proxy/test-proxy 1>${{ parameters.rootFolder }}/test-proxy.log 2>${{ parameters.rootFolder }}/test-proxy-error.log & echo $! > $(Build.SourcesDirectory)/test-proxy.pid echo "##vso[task.setvariable variable=PROXY_PID]$(cat $(Build.SourcesDirectory)/test-proxy.pid)"