tee for SLURM) under {output_dir}/logs/. For RL training, we recommend streaming logs into tmux panes (as set up by tmux.sh).
Logger Architecture
setup_logger and get_logger
We use a singleton pattern with a module-level global logger instance (_LOGGER).
-
get_logger()- Returns the global logger instance. Always works — ifsetup_loggerhasn’t been called yet, it initializes a default logger automatically. Safe to call from any module at any time. -
setup_logger(log_level)- Configures (or reconfigures) the global logger:- Creates an isolated loguru
Loggerinstance (not the defaultloguru.logger) to prevent third-party code from hijacking our logs - Adds a stdout handler with colorized output (or JSON output if
json_logging=True) - Can be called multiple times — cleans up the previous logger before creating a new one
- Creates an isolated loguru
-
reset_logger()- Resets the global logger toNone:- Used in subprocesses that inherit parent state (e.g., env workers)
- Used in tests between test cases
Log File Structure
Logs are captured at the deployment level — the entrypoint redirects subprocess stdout/stderr to files (local) ortee captures them (SLURM). The structure is consistent across deployment types: logs/trainer.log and logs/inference.log always exist, regardless of whether the run is local or multi-node SLURM.
Local (single node)
SLURM multi-node
logs/envs/train/{env_name}/ and logs/envs/eval/{env_name}/. Env log verbosity is controlled by orchestrator.log.vf_level.
Only rank 0 output is shown in trainer.log. Per-rank logs from all ranks are available under logs/trainer/torchrun/{rdzv_id}/attempt_0/{rank}/{stdout,stderr}.log, written by torchrun’s --log-dir.
tmux helper (scripts/tmux.sh)
scripts/tmux.sh sets up a tmux session for RL runs with four panes:
- Trainer: follows
{output_dir}/logs/trainer.log - Orchestrator: follows
{output_dir}/logs/orchestrator.log - Envs: follows
{output_dir}/logs/envs/*/*/*.log - Inference: follows
{output_dir}/logs/inference.log