Having the following logging:
log_name = pd.datetime.now().date().strftime(format="%Y-%m-%d")+".log" #Current day
log_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))+"/logs/" #Path
logging.basicConfig(filename=log_path+log_name,filemode="a",level = logging.INFO)
is there a way to catch "Unknown" exceptions (such as pd.to_sql
errors due to e.g typo in the column name) and write them to the same logger file specified in logging.basicConfig
without having try/catches all over the place?