llama_index icon indicating copy to clipboard operation
llama_index copied to clipboard

"force" logging configuration is required because logging.basicConfig is written in github_repository_reader.py

Open tdc-yamada-ya opened this issue 2 years ago • 0 comments

The following code does not reflect the logging settings.

from llama_index import GPTSimpleVectorIndex
from llama_index.readers.base import BaseReader
from llama_index.readers.schema.base import Document

...

if __name__ == "__main__":
    logging.basicConfig(stream=sys.stdout, format="%(asctime)s %(message)s", level=logging.DEBUG)
    logger.debug("test")

It can be solved by adding force parameter as the following code:

    logging.basicConfig(stream=sys.stdout, format="%(asctime)s %(message)s", level=logging.DEBUG, force=True)

I think the cause of the problem is that logging.basicConfig is written in github_repository_reader.py.

https://github.com/jerryjliu/llama_index/blob/41ccffe0bbf794fa884d5994f18d9fc8c30445c6/gpt_index/readers/github_readers/github_repository_reader.py#L33

tdc-yamada-ya avatar Mar 13 '23 02:03 tdc-yamada-ya