'Log file not created

I am trying to create a log file as follows:

 logging.basicConfig(filename='app.log', filemode='w', format='%(name)s - %(levelname)s - % 
(message)s')

the second method is:

logging.basicConfig(filename='sample11.log', format='%(asctime)s | %(levelname)s: % 
(message)s', level=logging.info)

 logging.info(str(size_df))

size_df is just len(df)

When I was applying this before the logging did work. Would anyone know the problem?



Solution 1:[1]

Try:

logging.basicConfig(filename='sample11.log', format='%(asctime)s | %(levelname)s: % (message)s', level=logging.INFO)

The logging levels need to be UPPERCASE.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 slass100