# Programmatically retrieve full console logs (stdout/stderr) of a W&B run

**URL:** <https://community.wandb.ai/t/programmatically-retrieve-full-console-logs-stdout-stderr-of-a-w-b-run/18132>\
**Category:** W&B Help\
**Tags:** wandb\
**Created:** [October 30, 2025, 8:16pm UTC](https://community.wandb.ai/t/programmatically-retrieve-full-console-logs-stdout-stderr-of-a-w-b-run/18132 "2025-10-30T20:16:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cloudflare-r2-sn3-4](https://avatars.discourse-cdn.com/v4/letter/c/a698b9/32.png) [@cloudflare-r2-sn3-4](https://community.wandb.ai/u/cloudflare-r2-sn3-4)\
**Post date:** [October 30, 2025, 8:16pm UTC](https://community.wandb.ai/t/programmatically-retrieve-full-console-logs-stdout-stderr-of-a-w-b-run/18132/1 "2025-10-30T20:16:23Z")

</div>

I’m trying to programmatically retrieve the **full console logs** from one of my runs – essentially the same output shown under the _Logs_ tab (including all stdout/stderr and any `wandb:` messages). My goal is to save these logs locally for debugging, archival, or post-processing purposes.

**What I’ve tried/researched:**

- **Using the Python API for run history:** I attempted `wandb.Api().run("entity/project/run_id").history()`, but realized this only returns metrics logged via `wandb.log()` (the run’s history of metrics), not the console text.

- **Listing run files:** I used `run.files()` and noticed that for a **finished** run, there is an `output.log` file (which I believe contains the console output). In the web UI, I also see a “Download logs” button for finished runs. I suspect I can download that file via the API (maybe with `run.file("output.log").download()` as hinted in [W&B docs/forums]). Before going down that route, I wanted to confirm if this is the recommended approach.

- **Runs not finished:** One concern is runs that **crash or are still running**. In one case, a run crashed and I didn’t see an `output.log` in the files. The UI still displayed the partial logs, but there was no download button. I came across a GitHub issue suggesting that `output.log` is only downloadable for finished runs, not for crashes. Is there any workaround or API method to get logs from a crashed or ongoing run? For example, can we fetch the live log stream or force an upload of the log before a run finishes?

**What I’m looking for:**

- A supported way (via the W&B Python SDK or CLI) to **download the complete console log** of a run. If the solution is to use the Python API to grab `output.log`, I’ll gladly do that – just want to ensure I’m not missing a more direct method.

- Any best practices for capturing these logs, especially in cases where a run might not finish cleanly. My use case is to automatically archive logs for all runs (successful or not) for later analysis.

I appreciate any guidance! If there’s an existing feature or a known workaround that I missed, please let me know. Thank you in advance for your help 🙂
