# Start Python API and redirect ALL output to log file $apiPath = "C:\DEV\COPILOT\geutebruck-api\src\api" $uvicorn = "C:\DEV\COPILOT\geutebruck-api\.venv\Scripts\uvicorn.exe" $logFile = "C:\DEV\COPILOT\api_full_output.log" # Remove old log if (Test-Path $logFile) { Remove-Item $logFile -Force } Write-Host "Starting API with logging to $logFile" -ForegroundColor Cyan # Start with output redirection (using cmd to combine stdout and stderr) $cmd = "cmd.exe" $cmdArgs = "/c", "cd /d `"$apiPath`" && `"$uvicorn`" main:app --host 0.0.0.0 --port 8000 --reload > `"$logFile`" 2>&1" Start-Process -FilePath $cmd ` -ArgumentList $cmdArgs ` -WindowStyle Hidden Start-Sleep -Seconds 2 $process = Get-Process -Name "uvicorn" -ErrorAction SilentlyContinue if ($process) { Write-Host "API started (PID: $($process.Id))" -ForegroundColor Green Write-Host "Logs: $logFile" -ForegroundColor Gray } else { Write-Host "Failed to start API" -ForegroundColor Red }