Logging
Railtracks provides built-in logging to help track the execution of your flows. Logs are automatically generated and can be viewed in the terminal or saved to a file.
Example Logs
[+3.525 s] RT : INFO - START CREATED Github Agent
[+8.041 s] RT : INFO - Github Agent CREATED create_issue
[+8.685 s] RT : INFO - create_issue DONE
[+14.333 s] RT : INFO - Github Agent CREATED assign_copilot_to_issue
[+14.760 s] RT : INFO - assign_copilot_to_issue DONE
[+17.540 s] RT : INFO - Github Agent CREATED assign_copilot_to_issue
[+18.961 s] RT : INFO - assign_copilot_to_issue DONE
[+23.401 s] RT : INFO - Github Agent DONE
Critical
Every log sent by Railtracks will contain a parameter in extras for session_id which will be uuid tied to the session the error was thrown in.
Configuring Logging
Logging Levels
Railtracks supports four logging levels:
VERBOSE: Includes all logs, includingDEBUG.REGULAR: (Default) IncludesINFOand above. Ideal for local development.QUIET: IncludesWARNINGand above. Recommended for production.NONE: Disables all logging.
rt.set_config(logging_setting="VERBOSE")
rt.set_config(logging_setting="REGULAR")
rt.set_config(logging_setting="QUIET")
rt.set_config(logging_setting="NONE")
Logging Handlers
Console Handler
By default, logs are printed to stdout and stderr.
File Handler
To save logs to a file, pass a log_file parameter to the config:
Custom Handlers
Railtracks uses the standard Python logging module with the RT prefix. You can attach custom handlers:
Example Usage
You can configure logging globally or per-run.
Global Configuration
This will apply to all flows.
Scoped Configuration
Applies only within the context of theSession.
Forwarding Logs to External Services
You can forward logs to services like Loggly, Sentry, or Conductr by attaching custom handlers. Refer to each provider's documentation for integration details.
Log Message Examples
DEBUG Messages
| Type | Example |
|---|---|
| Runner Created | RT.Runner : DEBUG - Runner <RUNNER_ID> is initialized |
| Node Created | RT.Publisher: DEBUG - RequestCreation(current_node_id=<PARENT_NODE_ID>, new_request_id=<REQUEST_ID>, running_mode=async, new_node_type=<NODE_NAME>, args=<INPUT_ARGS>, kwargs=<INPUT_KWARGS>) |
| Node Completed | RT.Publisher: DEBUG - <NODE_NAME> DONE with result <RESULT> |
INFO Messages
| Type | Example |
|---|---|
| Initial Request | RT : INFO - START CREATED <NODE_NAME> |
| Invoking Nodes | RT : INFO - <PARENT_NODE_NAME> CREATED <CHILD_NODE_NAME> |
| Node Completed | RT : INFO - <NODE_NAME> DONE |
| Run Data Saved | RT.Runner : INFO - Saving execution info to .railtracks\<RUNNER_ID>.json |
WARNING Messages
| Type | Example |
|---|---|
| Overwriting File | RT.Runner : WARNING - File .railtracks\<RUNNER_ID>.json already exists, overwriting... |
ERROR Messages
| Type | Example |
|---|---|
| Node Failed | RT : ERROR - <NODE_NAME> FAILED |