Enable Logging

You can add logging to determine what the BAML runtime is doing.

To enable logging, set the BAML_LOG environment variable:

1# default is warn
2BAML_LOG=info
LevelDescription
errorFatal errors by BAML
warnLogs any time a function fails (includes LLM calling failures, parsing failures)
infoLogs every call to a function (including prompt, raw response, and parsed response)
debugWay more than you think you need
traceEverything and more
offNo logging

Example log:


Since >0.54.0:

To truncate each log entry to a certain length, set the BOUNDARY_MAX_LOG_CHUNK_CHARS environment variable:

1BOUNDARY_MAX_LOG_CHUNK_CHARS=3000

This will truncate each part in a log entry to 3000 characters.