Log streaming
Access logs generated by a sandbox in real time.
Logging provides developers with visibility into process outputs within sandboxes. You can retrieve logs either in batch or streaming.
Retrieve logs
Set up authentication to Blaxel
Set up authentication to Blaxel
The Blaxel SDK authenticates with your workspace using credentials from these sources, in priority order:
- when running on Blaxel, authentication is handled automatically
- variables in your
.env
file (BL_WORKSPACE
andBL_API_KEY
, or see this page for other authentication options). - environment variables from your machine
- configuration file created locally when you log in through Blaxel CLI (or deploy on Blaxel)
When developing locally, the recommended method is to just log in to your workspace with Blaxel CLI. This allows you to run Blaxel SDK functions that will automatically connect to your workspace without additional setup. When you deploy on Blaxel, this connection persists automatically.
When running Blaxel SDK from a remote server that is not Blaxel-hosted, we recommend using environment variables as described in the third option above.
In batch
Retrieve logs for a specific process (using either its name or process ID) after it has completed execution. By default, this retrieves standard output (stdout):
To retrieve standard error (stderr):
To retrieve both stderr and stdout:
Streaming
Stream logs for a specific process (using either its name or process ID):