Debugging ziti-sdk-py with ZITI_LOG

The ZITI_LOG env var is known to configure the wrapped ziti-sdk-c log level, but I’m not getting any extra output from Ziti when I run my Python program with ZITI_LOG=4. I expected to see debug level from the C SDK on stdout, and I seem to remember that’s how it worked previously.

I did

pip install openziti

in a fresh Python virtualenv and got 0.7.1. I verified that the 64bit libziti.so was auto-downloaded in the lib sub-dir of the installed package, and so that all looks normal.

I tried setting ZITI_LOG in the Python program’s env as well as exporting to child processes.

I’m using the SDK like this:

  with openziti.monkeypatch():
    r = requests.post(url, headers=headers, data=data)

You need to load an identity – either via ZITI_IDENTITIES env var or explicitly openziti.load()

Thanks, it works with openziti.load(). I had set ZITI_IDENTITIES in my program after import openziti and wasn’t getting any logs for some reason.

import openziti no longer does the loading. It is deferred until the first use of openziti. This was done based on internal discussions with @sabedevops

Is this accurate @ekoby? I do think import openziti still does load the identities. I think the issue here is that ZITI_IDENTITIES wasn’t set in the environment before running the program, but rather, set inside the program after the import of the module.

Edit: Perhaps, the fact he ran into this issue as well does suggest that the pattern of loading at import time should be revisited.

umm, I think you’re correct.

also, setting env var from inside the python script/program is silly, you should just call openziti.load()