Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import logging not working
#1
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
Error:
Traceback (most recent call last): File "H:\New folder\logging.py", line 1, in <module> import logging File "H:\New folder\logging.py", line 15, in <module> logging.basicConfig(filename='test.log', level=logging.DEBUG, AttributeError: module 'logging' has no attribute 'basicConfig'
Reply


Messages In This Thread
import logging not working - by segerhult - Feb-07-2019, 04:10 PM
RE: import logging not working - by buran - Feb-07-2019, 04:38 PM
RE: import logging not working - by segerhult - Feb-07-2019, 04:47 PM
RE: import logging not working - by buran - Feb-07-2019, 05:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't import logging hary 2 2,733 Jun-28-2022, 07:46 PM
Last Post: hary
  Pathlib import not working chriswrcg 9 3,996 May-29-2022, 07:37 PM
Last Post: snippsat
  How to keep a loop containing a web import working in python executable? coder1384 3 2,971 Feb-22-2020, 06:49 PM
Last Post: snippsat
  Python logging RotatingFileHandler and TimedRotatingFileHandler is not working with Q waytosatyam7 2 4,910 Dec-24-2019, 08:44 AM
Last Post: buran
  CSV import is not working gehrenfeld 7 4,344 Dec-12-2018, 12:26 PM
Last Post: gehrenfeld
  import keyboard module doesn't get found - working on laptop but no on raspberry pi.. HANSJORG2 1 8,280 Mar-16-2018, 02:48 PM
Last Post: sparkz_alot
  import not working properly mepyyeti 5 4,544 Jan-18-2018, 07:08 AM
Last Post: metulburr
  Logging module stopped working! llanitedave 1 8,173 Oct-18-2017, 06:45 AM
Last Post: llanitedave
  import commands modules not working in python 3.6.0 bmohanraj91 2 17,791 May-01-2017, 10:59 AM
Last Post: bmohanraj91
  import antigravity not working Skaperen 8 7,630 Feb-19-2017, 05:49 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020