Skip to content

Commit

Permalink
Support Test Proxy logging error output into a different log file (Az…
Browse files Browse the repository at this point in the history
…ure#31759)

Co-authored-by: alzimmermsft <[email protected]>
  • Loading branch information
azure-sdk and alzimmermsft authored Dec 6, 2024
1 parent c6f2ae7 commit ab04533
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions eng/common/testproxy/publish-proxy-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions eng/common/testproxy/test-proxy-standalone-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ 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'
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
# 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)"
Expand Down
5 changes: 3 additions & 2 deletions eng/common/testproxy/test-proxy-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)"
Expand Down

0 comments on commit ab04533

Please sign in to comment.