{"record":{"id":"77dcc32b9a8342bb","repo":"jax-ml/jax","slug":"attempting-to-set-log-level-logging-level-whic","errorCode":null,"errorMessage":"Attempting to set log level \"{logging_level}\" which isn't one of the supported: {list(_tf_cpp_map.keys())}.","messagePattern":"Attempting to set log level \"(.+?)\" which isn't one of the supported: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/logging_config.py","lineNumber":55,"sourceCode":"    'NOTSET': logging.NOTSET,\n}\n\n_tf_cpp_map = {\n    'CRITICAL': 3,\n    'FATAL': 3,\n    'ERROR': 2,\n    'WARN': 1,\n    'WARNING': 1,\n    'INFO': 0,\n    'DEBUG': 0,\n}\n\ndef _set_cpp_min_log_level(logging_level: str | None = None):\n  if logging_level in (None, \"NOTSET\"):\n    return\n  # set cpp runtime logging level if the level is anything but NOTSET\n  if logging_level not in _tf_cpp_map:\n    raise ValueError(f\"Attempting to set log level \\\"{logging_level}\\\" which\"\n                      f\" isn't one of the supported:\"\n                      f\" {list(_tf_cpp_map.keys())}.\")\n  # config the CPP logging level 0 - debug, 1 - info, 2 - warning, 3 - error\n  log_level = _tf_cpp_map[logging_level]\n  utils.absl_set_min_log_level(log_level)\n\ndef update_logging_level_global(logging_level: str | None) -> None:\n  # remove previous handlers\n  for logger_name, level in _logging_level_set.items():\n    logger = logging.getLogger(logger_name)\n    logger.removeHandler(_jax_logger_handler)\n    logger.setLevel(level)\n  _logging_level_set.clear()\n  _set_cpp_min_log_level(logging_level)\n\n  if logging_level is None:\n    return\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/logging_config.py#L37-L73","documentation":"_set_cpp_min_log_level maps Python logging level names to TF/absl C++ levels via _tf_cpp_map. Passing a level string that isn't a key (e.g. 'DEBUG ' with whitespace, numeric 10, or 'verbose') raises ValueError listing the supported names. This runs whenever JAX updates its global logging level, typically from the jax_logging_level config.","triggerScenarios":"Setting jax_logging_level config or JAX_LOGGING_LEVEL env var to an unsupported value like 'debug' lowercase variants not in the map, '10', 'VERBOSE', or a misspelled level; calling update_logging_level_global('warn ') with trailing space.","commonSituations":"Setting JAX_LOGGING_LEVEL in a container/Dockerfile or CI with an invalid string; libraries like TensorFlow interacting with the shared absl config; version changes altering supported level names.","solutions":["Use one of the exact names in the error message (e.g. 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL')","Check for typos, quotes, or whitespace in JAX_LOGGING_LEVEL env var values","Strip/normalize the string before assigning: logging_level.strip().upper()","If a number was passed, convert to the canonical name first"],"exampleFix":"# before\njax.config.update('jax_logging_level', 'verbose')\n\n# after\njax.config.update('jax_logging_level', 'DEBUG')","handlingStrategy":"validation","validationCode":"level = 'DEBUG'\nfrom jax._src.logging_config import _tf_cpp_map  # or hardcode valid names\nvalid = {'DEBUG','INFO','WARNING','ERROR','FATAL'}\nassert level in valid","typeGuard":"def is_valid_log_level(s: str) -> bool:\n    return s in {'DEBUG','INFO','WARNING','ERROR','FATAL'}","tryCatchPattern":null,"preventionTips":["Normalize env-provided levels: level.strip().upper()","Document exact level names in deployment docs","Fail fast on config parse instead of passing through"],"tags":["jax","logging","config","valueerror"],"backgroundTag":"invalid-enum-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}