Built-in Logging
By default BaseModel streams logs to the console at INFO level. For production runs or debugging you can redirect output to files, adjust verbosity, or separate error logs — all by pointing to a custom config file.
Custom Logging Config
Create a YAML file using Python's logging dict schema and set the MONAD_LOGGING_CONFIG_PATH environment variable before starting BaseModel:
Or pass it when launching the container:
docker run -it \
-e MONAD_LOGGING_CONFIG_PATH=/basemodel/logging_config.yaml \
--gpus all --shm-size 64gb \
-v /your/basemodel/folder:/basemodel:z \
REGISTRY_URL/monad:VERSION
Renamed in monad 1.11
The logging environment variables are namespaced under MONAD_LOGGING_* as of monad 1.11.0. MONAD_LOGGING_CONFIG_PATH replaces the former LOGGING_CONFIG_PATH — update any scripts that set the old name.
Log Output Directory
By default BaseModel writes its log files (including an aggregate full.log) next to the run, using the paths baked into the image's logging config. When the container runs under an arbitrary or non-root UID — or the default location is read-only — file logging can fail with LoggingSetupError: Cannot create or write the log directory.
Set MONAD_LOGGING_DIRECTORY to a writable, mounted path to redirect all log files there:
docker run -it \
-e MONAD_LOGGING_DIRECTORY=/basemodel/logs \
--gpus all --shm-size 64gb \
-v /your/basemodel/folder:/basemodel:z \
REGISTRY_URL/monad:VERSION
Leaving it unset (or blank) keeps the default filenames from the logging config.
Example Config
The config below keeps the default console output and adds two rotating file handlers — one for general logs and one for errors only:
version: 1
formatters:
default:
format: "%(asctime)s - %(levelname)8s - %(name)s: %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
handlers:
console:
class: logging.StreamHandler
level: INFO
formatter: default
stream: ext://sys.stdout
mainFile:
class: logging.FileHandler
level: INFO
formatter: default
filename: logs/main.log
mode: a
errorFile:
class: logging.FileHandler
level: ERROR
formatter: default
filename: logs/error.log
mode: a
loggers:
monad:
level: INFO
handlers: [console, mainFile, errorFile]
propagate: False
root:
level: WARNING
handlers: []
Key points:
monadlogger — captures all BaseModel output. Set itsleveltoDEBUGfor verbose diagnostics orWARNINGto silence routine messages.rootlogger — catches everything else (third-party libraries). Keep atWARNINGor higher to avoid noise.- File handlers —
mainFilerecords the full run log;errorFileisolates errors for quick scanning. Create thelogs/directory before training starts, or use absolute paths.