import logging not working - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: import logging not working (/thread-15950.html) |
import logging not working - segerhult - Feb-07-2019 when i run my code it says there is somthing wrong whit import logging and thus the cod dose not work import logging #import time #import mylib # DEBUG: Detailed information, typical of intrest # INFO: Confirmation that things are working as expected # WARNINGS: An indication that somthing unexpected happened, or indicative of any problems # ERORR: Due to a more serious problem, the softwear hace not been abble to perform a funktion # CRITICAL: A incidcation of a serius error logging.basicConfig(filename='test.log', level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(message)s') #class Logging: #def __init__(self, battery, charge_of_battery): #self.battery = battery #self.charge_of_battery = charge_of_battery #logging.debug('battery log:') #def state(self): #return '{}.{} battery lvl->'.format(self.) logg_1 = 'error error', '123v2ecwadcsa212' #time.sleep( 10 ) logging.debug('battery log: {}'.format(logg_1))This is the error is what is what im geting when i run the code
RE: import logging not working - buran - Feb-07-2019 your own script is named logging.py, thus overriding the module with that name from Standard Library. Rename your script. RE: import logging not working - segerhult - Feb-07-2019 Im still getting this
RE: import logging not working - buran - Feb-07-2019 Check this for the solution https://stackoverflow.com/a/514395/4046632 |