osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

log file


On Thursday, March 21, 2019 at 10:26:14 PM UTC-5, Sharan Basappa wrote:
> I am running a program and even though the program runs all fine, the log file is missing. I have pasted first few lines of the code.
> 
I am thinking--hoping, rather--that you just kind of double pasted there. Anyways, you needed to specify the logging level in basicConfig:

import os
import csv
import logging
import random

#Create and configure logger
# Check out level=logging.INFO
logging.basicConfig(filename="test_1.log", filemode='w', format='%(asctime)s %(message)s', level=logging.INFO)
log = logging.getLogger()
log.info("Yay!")