How to Copy an Error Log Without the Noise
To share an error log, copy the error message, the stack frames that point at your own code, and one line of context: the command you ran and the versions involved. Leave out startup chatter, repeated warnings and shutdown messages, redact any token or password, and paste the excerpt as a code block. If someone needs the whole log, attach it as a file rather than pasting it.
Which lines to keep
| Part of the log | Keep it? |
|---|---|
| The error or exception message | Yes, word for word |
| Stack frames in your own code | Yes |
| The first framework or library frame below your code | Usually, it shows what your code called |
| Deeper framework frames | Only if the failure is inside the framework |
Caused by sections (Java and similar) | Yes, especially the last one |
| Warnings just before the error | Only if they mention the same component |
| Startup, connection and shutdown messages | No, unless the bug is in startup or shutdown |
| Timestamps | Only if timing or ordering is part of the problem |
How to read the common formats:
- Python: tracebacks are printed "most recent call last", so the exception type and message are on the final line, and the frames just above it are where it happened.
- Java: the top frame of the first trace is where the exception was thrown. Each
Caused by:section is an underlying exception; the last one is usually the root cause. Lines like... 12 moremean frames were omitted because they repeat the trace above. - .NET and Node.js: the message comes first, followed by frames with the most recent call at the top.
Then add the context the log doesn't show: what you ran, what you expected, and the versions of the runtime and key packages.
How to copy from a terminal
In Windows Terminal:
- Drag with the mouse to select the lines, or press Ctrl+Shift+M for mark mode and select with the keyboard.
- Press Ctrl+C, Ctrl+Shift+C or Enter to copy. When text is selected, Ctrl+C copies instead of interrupting the running program.
- To select a rectangle of text, such as one column, hold Alt while you drag.
If the output is long, don't scroll and drag. Open the command palette (Ctrl+Shift+P), type "export" and run the export buffer command, which saves the whole scrollback to a text file. Then copy the part you need from an editor. Copying plain text from Windows Terminal covers copy formatting and the other Windows Terminal options.
How to capture output to a file first
It's easier to pick an excerpt from a file than from a scrolling console. In PowerShell, Tee-Object shows output on screen and writes it to a file at the same time:
npm test 2>&1 | Tee-Object -FilePath test.log
Then copy the end of the file, where errors usually are:
Get-Content .\test.log -Tail 40 | Set-Clipboard
In WSL or Git Bash, use tee the same way, and find the error with line numbers before printing just that range:
npm test 2>&1 | tee test.log
grep -n "Error" test.log
sed -n '120,150p' test.log
The PowerShell clipboard cheat sheet has more ways to move output onto the clipboard.
Redact before you paste
Error messages often contain secrets: a connection string with the password in it, a request URL with an API key in the query string, or an Authorization header. Replace the value, keep the shape:
Before: Unauthorized for url: https://api.example.com/v1/invoices?api_key=abc123SECRETvalue
After: Unauthorized for url: https://api.example.com/v1/invoices?api_key=<redacted>
If a real secret has already been pasted into a chat, ticket or issue, deleting the message isn't enough; revoke the credential and issue a new one. How to redact tokens from stack traces has search patterns and a script.
Example: from console dump to useful excerpt
A failing job might print a few hundred lines. The part worth sharing looks like this, preceded by one line of context such as "Running the invoice sync job on Python 3.11 with requests 2.32; started failing after the key rotation":
Traceback (most recent call last):
File "/app/src/billing/sync.py", line 88, in sync_invoices
resp.raise_for_status()
File ".../site-packages/requests/models.py", in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.example.com/v1/invoices?api_key=<redacted>
It keeps the frame in your code, the library call that raised the error, and the full error line, with the key removed. The startup lines and the retries that followed are gone.
How to paste it so it stays readable
- Slack: wrap the excerpt in triple backticks to make a code block. For longer logs, create a text snippet: click the plus button by the message field and choose Create a text snippet. Or type the text in the message field and press Ctrl+Shift+Enter to turn it into a snippet.
- GitHub issues and pull requests: use a fenced code block. For a long log, attach the file, or put it inside a collapsed section using the
detailsandsummarytags so it doesn't fill the page. If you're commenting on someone else's pull request, add the excerpt to a pending review so it goes out with your other notes; batching code review comments shows how. - Jira and other trackers: use the code block formatting the tracker offers and attach the full log as a file.
- Email: attach the log as a
.txtor.logfile; paste only the excerpt into the body.
Code blocks keep the indentation and line breaks that make tracebacks readable, and stop chat apps from turning text into links, emoji or formatting.
FAQ
How many lines should I paste?
As many as it takes to show the error and where it came from in your code, often under 20. Attach the rest rather than guessing what to cut.
Should I include timestamps?
Only if timing matters, for example for a timeout, a race or events in the wrong order. Otherwise they make lines longer without adding information.
Why does my pasted log look garbled?
Colour codes or rich formatting came along with the text. Copy as plain text, or paste with Ctrl+Shift+V where the app supports it; how to paste without formatting on Windows covers each app.
Related reading
- How to Redact Tokens From Stack Traces Before Sharing
- Windows Terminal: Copy Plain Text Without Formatting
- Clipboard Tips for Developers on Windows
- PowerShell Clipboard Cheat Sheet: Get-Clipboard and Set-Clipboard
Sources
- Errors and Exceptions (Python docs) — how tracebacks are structured.
- Throwable (Java SE API) — printStackTrace output, "Caused by" and "... n more".
- Windows Terminal actions (Microsoft Learn) — copy bindings, mark mode, export buffer.
- Windows Terminal command palette (Microsoft Learn) — Ctrl+Shift+P.
- Windows Terminal interaction settings (Microsoft Learn) — block selection with Alt.
- Tee-Object (Microsoft Learn) — writing output to a file and the console.
- Create or paste code snippets in Slack (Slack Help) — text snippets and Ctrl+Shift+Enter.
- Organizing information with collapsed sections (GitHub Docs) — details and summary tags.
Deepender Yadav created Edge Drop and builds and tests it, from the edge-hover shelf to each release. A B.Tech Computer Science Engineering student, Deepender writes the Edge Drop guides, comparisons and developer posts, and checks product details against the app's source code.
GitHub · LinkedInCopy. Stack. Drop.
Transform your clipboard into an interactive edge shelf. Stack, pin, and drag assets into any app with zero friction.
Download for Windows Get from Microsoft Store
How to Install Guide · First 10 Minutes Guide · Drag & Drop Guide · Edge Drop vs Win+V · Support
Free · Lightweight · Privacy First