Resetting the Python logger level

| python

I wanted to get extra debugging output from a Python script that I was running, but one of my imports seemed to mess things up and the logger level was 20 (info) instead of debug.

import logging
from llama_index import GPTSimpleVectorIndex, MockLLMPredictor, MockEmbedding, QuestionAnswerPrompt
logging.debug('This is a test.')

As it turns out, there was already a call to basicConfig in which llama_index loaded at some point, and the Python documentation says: "As it’s intended as a one-off simple configuration facility, only the first call will actually do anything: subsequent calls are effectively no-ops."

So this is what I needed to do instead:

You can comment with Disqus or you can e-mail me at