Mysterious logging.basicConfig problem (Python)

I am writing a Python script to retrieve data from Flickr. For logging purposes, I have the following setup function:

def init_log(logfile):
    format = '%(asctime)s - %(levelname)s - %(message)s'
    logging.basicConfig(filename=logfile,level=logging.DEBUG,format=format)

I tested this with the python shell and it works as expected, creating a file if it does not already exist. But a call from my program is where it stops working. The function is definitely called, and the parameter logfileworks correctly - it logging.basicConfigsimply does not create any file. I do not even get any errors or warnings.

My use of the Python Flickr API may be the culprit, but I doubt it. Any ideas?

+3
source share
1 answer

logging.basicConfig -, . , , , no-op ( ).

, API- Python Flickr , , basicConfig .

+5

Source: https://habr.com/ru/post/1745427/


All Articles