Skip to content

Static pybind lm_info ignores env ORT_LOGGING_LEVEL #27092

@miraculixx

Description

@miraculixx

Description

In Python, importing onnxruntime emits un-suppressible GPU discovery warning despite ORT_LOGGING_LEVEL=ERROR/FATAL.

$ export ORT_LOGGING_LEVEL=ERROR
$ python -c "import onnxruntime as ort
2026-01-21 12:08:58.794991221 [W:onnxruntime:Default, device_discovery.cc:164 DiscoverDevicesForPlatform] GPU device discovery failed: device_discovery.cc:89 ReadFileContents Failed to open file: "/sys/class/drm/card3/device/vendor"

Occurs in Docker/Linux without GPU present or no permissions.

Expected

env var ORT_LOGGING_LEVEL is respected, no hard coded logging level.

Root Cause
onnxruntime/python/onnxruntime_pybind_module.cc statically initializes LoggingManager lm_info at module load:

  • Hard-coded to ORT_LOGGING_LEVEL_WARNING
  • Bypasses env variable ORT_LOGGING_LEVEL

[source](

OrtEnv::LoggingManagerConstructionInfo lm_info{nullptr, nullptr, ORT_LOGGING_LEVEL_WARNING, "Default"};
Status status;
ort_env = OrtEnv::GetOrCreateInstance(lm_info, status, use_global_tp ? &global_tp_options : nullptr).release();
)

Environment

  • OS: Linux Mint native, within Docker
  • Python 3.10, 3.11
  • onnxruntime-gpu 1.23.2

Repro

export ORT_LOGGING_LEVEL=ERROR
python -c "import onnxruntime as ort"
# Still warns
2026-01-21 12:08:58.794991221 [W:onnxruntime:Default, device_discovery.cc:164 DiscoverDevicesForPlatform] GPU device discovery failed: device_discovery.cc:89 ReadFileContents Failed to open file: "/sys/class/drm/card3/device/vendor"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions