0

when i using

logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)

i cant create log file, and when i using

logging.debug('This message should go to the log file')

it will create as many times of line after execute it. like this

This message should go to the log file
This message should go to the log file
This message should go to the log file
This message should go to the log file
This message should go to the log file
This message should go to the log file
  • Can you provide the full code, is the log line inside a loop? – dinhit May 17 '23 at 10:02
  • Does this answer your question? [Python logging module is printing lines multiple times](https://stackoverflow.com/questions/17745914/python-logging-module-is-printing-lines-multiple-times) – SanguineL May 17 '23 at 12:04

1 Answers1

0

try providing the path where the file should be created, may be it will create the log file

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 17 '23 at 14:27