Hello everyone, ![]()
Beware that: Logging in n8n is not just for debugging errors, itβs a strategy for building reliable, and production-ready workflows.
This txt covers:
- Console logging
- Visual logging with Set node
- Branch-based debug architecture
- Production-safe patterns
Why Logging Matters
Without structured logging, debugging becomes guesswork, so, good logging lets you:
- Inspect API responses.
- Track data transformations.
- Debug nested JSON.
- Verify image/binary handling.
- Monitor production workflows.
- Freeze data state before transformations.
Now, letβs explore 2 methods:
Method 1 β Code Node Logging (console.log())
Inside a Code node:
// JavaScript
console.log("Incoming data:", $input.all());
return $input.all();
For more details about Code Node see: the official documentation.
Where logs appear:
- Self-hosted: in terminal
- Docker : in
docker logs <container> - Cloud: in Execution logs
When to use:
Deep debugging.
Complex logic.
Development phase.
You need full data visibility.
When NOT to use:
Large base64 images
Production heavy workflows
When UI inspection is enough
Method 2 β Visual Logging with a Set Node (UI Debug)
This is the safest UI-based debugging method.
Step-by-step
- Add a Set node after the node you want to inspect.
- Add a field:
- Type: JSON
- Name:
debug
- Switch value to Expression mode:
={{ $json }}
For more details about Edit Fields [Set], see the official documentation
then Turn on (Include other Input Fields), so, it creates a snapshot of data.
Now you can:
- Open Executions
- Click the Set node
- Inspect JSON / Table / Schema
No terminal required.
Why This Is Powerful
- Freezes original input state
- Makes nested JSON easy to inspect
- Non-technical users can debug
- Perfect for API + LLM workflows
Should Logging Be in a Branch?
Recommended for Production
Main Flow
βββ Continue
βββ Debug Branch
Benefits:
- Doesnβt interfere with main logic
- Easy to disabler or remove
- Keeps workflow clean
- Prevents accidental data mutation
Inline Logging Is OK for:
- Learning
- Quick testing
- Small workflows
- Temporary debugging
Clean Debug Architecture Pattern
For serious workflows:
Trigger
β
Core Logic
β
IF Debug Mode?
βββ Yes β Debug Branch
βββ No β Continue
You can control debug mode by the following:
- Environment variable.
- Boolean flag in Set node.
- Workflow input parameter.
Final Advice
Logging is not about printing data, Itβs about:
- Controlling visibility.
- Freezing state.
- Preventing silent failures.
- Designing observable workflows.


