Registry / observability / robocorp-log

robocorp-log

JSON →
library3.1.2pypypi✓ verified 89d ago

Robocorp Log provides automatic trace logging capabilities for Python applications, primarily used within the Robocorp automation ecosystem. It automatically captures function calls, arguments, return values, and exceptions, generating structured log data for debugging and analysis. The current version is 3.1.2. It is part of the broader Robocorp framework, with releases often aligned with other components of the Robocorp ecosystem rather than having a standalone, independent cadence.

pip install robocorp-log
INSTALL
IMPORT
SIG · ROBOCORP-LOG
R
robocorp-log
observabilitypythonv3.1.2
Install
1.9s avg
Import
88ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.094s · 21MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 1.9s · import 0.083s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

robocorp.log
✓ import robocorp.log
Main module for logging utilities.
setup_auto_logging
✓ from robocorp.log import setup_auto_logging
Used to explicitly enable automatic logging if not in a Robocorp-managed environment.
add_log_output
✓ from robocorp.log import add_log_output
Used to direct logs to a specific output directory, primarily for file-based logs.

This quickstart demonstrates how to manually set up `robocorp-log` to capture execution traces of Python functions. It configures a temporary directory for log output and explicitly calls `setup_auto_logging()` to enable the automatic instrumentation. Run this script, then inspect the generated files (e.g., `.robocorp_log`, `log.html`) in the `temp_robocorp_log_output` directory.

import os from robocorp.log import setup_auto_logging, add_log_output from pathlib import Path import shutil # Define a directory for log output log_output_dir = Path("temp_robocorp_log_output") # Ensure the log directory is clean before starting if log_output_dir.exists(): shutil.rmtree(log_output_dir) log_output_dir.mkdir(parents=True, exist_ok=True) # Add the log output target. This is crucial for logs to be written to a file. add_log_output(log_output_dir) # Manually set up auto-logging. # In a Robocorp-managed run (e.g., Robocorp Lab/Assistant), this is often automatic. setup_auto_logging() def process_data(value: str, count: int): """A sample function to demonstrate automatic logging.""" print(f"Processing value: {value} for {count} times") intermediate_result = f"Transformed_{value}" final_result = f"{intermediate_result}_{count}" if count > 1: print("Simulating a loop...") for i in range(count): print(f" Iteration {i+1}") return final_result if __name__ == "__main__": # Use environment variable for example input, common in automation input_value = os.environ.get('ROBOCORP_LOG_TEST_VALUE', 'sample_item') input_count = int(os.environ.get('ROBOCORP_LOG_TEST_COUNT', '1')) print(f"Starting demonstration with value='{input_value}', count={input_count}") result = process_data(input_value, input_count) print(f"Demonstration finished. Result: {result}") print(f"\nLogs (e.g., .robocorp_log, .html) can be found in: {log_output_dir.absolute()}") print("To view structured logs, use Robocorp Lab or a compatible viewer.")
Debug
Known issues
breakingrobocorp-log version 3.0.0 introduced a new structured log format (`.robocorp_log`) replacing older custom JSON or `output.xml` formats. Custom log parsers written for pre-3.0.0 versions will break.
fix
Update any custom log parsing logic to read the new `.robocorp_log` binary format. Robocorp tools like Robocorp Lab or Assistant automatically handle this format. Consider using `robocorp-log`'s own log viewing capabilities or converting to HTML for easier inspection.
affects: >=3.0.0
gotchaWhen running outside a Robocorp-managed environment (e.g., Robocorp Lab, Assistant, Control Room), automatic logging needs explicit setup. Without `setup_auto_logging()` and `add_log_output()`, no log files will be generated.
fix
Always call `from robocorp.log import setup_auto_logging, add_log_output` and then `add_log_output(Path('your_log_dir'))` and `setup_auto_logging()` at the start of your script if you expect file-based logs outside of a Robocorp run.
affects: All versions
gotchaBy default, `robocorp-log` captures all function arguments and return values. This can lead to sensitive information (e.g., API keys, passwords) being recorded in the logs.
fix
Use `robocorp.log.omit_secrets` as a context manager or `robocorp.log.add_sensitive_variables` to mark specific variables or function arguments for redaction in the logs.
affects: All versions
gotchaExtensive or deeply nested automatic logging can generate very large log files, potentially impacting performance and storage, especially for long-running or complex processes.
fix
Consider disabling auto-logging for specific functions or modules using `robocorp.log.exclude_methods_from_auto_logging` or tuning the level of detail if log file size becomes an issue. Only enable auto-logging for critical paths.
affects: All versions
Errors
Common errors & fixes
No .robocorp_log file or log.html is generated in the output directory.
`robocorp-log` was not properly initialized to write to a specific output or `setup_auto_logging()` was not called.
fix
Ensure you call `from robocorp.log import add_log_output, setup_auto_logging` and then `add_log_output(Path('your_log_directory'))` and `setup_auto_logging()` at the start of your script, especially when running outside the Robocorp environment.
My existing log parser for `output.xml` or custom JSON logs is failing after upgrading `robocorp-log`.
You've upgraded to `robocorp-log` version 3.0.0 or later, which switched to the `.robocorp_log` binary format.
fix
Your old log parsing logic is incompatible. You need to update your parsers to handle the new `.robocorp_log` format. Consult Robocorp's documentation for tools or libraries that can read this new format, or rely on Robocorp's own log viewing tools.
Sensitive data (e.g., API keys, passwords) is visible in my generated logs.
`robocorp-log` by default captures all function arguments and return values, including potentially sensitive ones.
fix
Use `robocorp.log.omit_secrets(value)` to redact specific values or `robocorp.log.add_sensitive_variables(variable_names)` to declare variables whose contents should be hidden in logs.
Upgrade
Version history
3.1.2latest on PyPI · released Mar 13, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
14
OpenAI (training)
3
Resources
robocorp-log — pip install robocorp-log · libregistry