I am using the logging module in python to generate logs files in a folder. The log files are all perfectly generated. The problem is inspite of specifying the location, they write to the Desktop folder and not to the specified location. I have tried printing the file path and it all looks good. Please see the snippet of code.
file_folder = "C:\\Users\\xyzzz\\Desktop\\logs"
log_filename = f"log_{datetime.now().strftime('%d%m%y-%H%M%S')}"
log_filepath = os.path.join(file_folder, log_filename)
print(log_filepath)
logging.basicConfig(level=logging.INFO, filename=log_filename, filemode="w", format="%(asctime)s - %(levelname)s - %(message)s", force=True)
It always writes to the desktop and not to the folder I have specified. Can someone suggest what is the mistake here.
Thanks