Log to File
Log to File
Section titled “Log to File”Type: log-to-file · Package: Core Activities v1.0.8
Appends a log line to a text file you choose, in the format [date] [LEVEL] message. Useful when you need to keep a record in a file of your own (an audit trail, a log another system watches, a cumulative report) in addition to the execution log the platform captures.
It is different from Log: log writes to the execution log (the one you see in the debug panel and in the Zoan Cloud logs); log-to-file writes to a file on disk. Use each depending on where you want the message to end up; you can use both at once.
How it works
Section titled “How it works”When the execution reaches the activity, it evaluates the message, formats it as a line ([2026-06-16 10:30:00] [INFO] message) and appends it to the file set in path, creating the file (and its folders) if they don’t exist. Each call adds a new line; it never overwrites what was already there. It does not stop the flow: it records and continues.
- The date uses the machine’s local time, in
yyyy-MM-dd HH:mm:ssformat. - The level is written in uppercase (
[INFO],[WARNING],[ERROR],[DEBUG]). - The file is written in UTF-8; each line ends with the system’s line break.
- A relative path, or just the file name (
process.log), is resolved against the robot’s working folder, not the project’s: use a full path so you always know where the file ends up. Since version 1.0.8; before, a bare file name made the activity fail.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path of the log file. It is created, along with its folders, if it doesn’t exist. With just the file name, it is written to the robot’s working folder. |
message | string | — | The text to log. It can be fixed text in quotes or an expression. If it evaluates to empty, the line has no message. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
level | string | "info" | Importance of the message. Values: info, warning, error, debug. Picked from a list (it is not an expression). |
timestamp | bool | true | Prefix each line with the date and time. With false the line is [INFO] message. |
Output
Section titled “Output”This activity does not return a value. The result is the line appended to the file.
Example
Section titled “Example”Keep a log of your own for the invoicing process:
Log to File path = "C:/logs/invoicing.log" level = info message = "Process started — " + str(rowCount(invoices)) + " invoices"
For Each items = invoices itemVariable = invoice └─ activities: Log to File path = "C:/logs/invoicing.log" level = error message = "Invoice " + str(invoice["Number"]) + " has no email"It produces a file like:
[2026-06-16 09:00:01] [INFO] Process started — 15 invoices[2026-06-16 09:00:04] [ERROR] Invoice INV-021 has no emailCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'path' is required. | path is empty or its expression returned null. |
| File or folder access error | The robot’s user has no write permission on that path, or another program has the file locked. Use a folder the robot can write to; to tolerate brief locks, wrap it in a Retry. |
Related activities
Section titled “Related activities”- Log — write to the execution log (not to a file).
- Append to File — append raw text to a file (without log formatting).
- Try / Catch — write the error caught in the
catchto a file.