Python 3.4.2日志记录不显示时间戳

Python 3.4.2日志记录不显示时间戳,python,logging,Python,Logging,我有一个Python pgm,我正在尝试添加日志记录。它正在进行日志记录,但没有向每个条目添加时间戳。我研究过它,读过文档,等等,它看起来写得对,但它没有给我时间戳。这里有什么不正确的地方 lfname = "TestAPIlog.log" logging.basicConfig(filename=lfname, format='%(asctime)s %(message)s', filemode='w', level=logging.WARNING ) logg

我有一个Python pgm,我正在尝试添加日志记录。它正在进行日志记录,但没有向每个条目添加时间戳。我研究过它,读过文档,等等,它看起来写得对,但它没有给我时间戳。这里有什么不正确的地方

lfname = "TestAPIlog.log"
logging.basicConfig(filename=lfname, format='%(asctime)s %(message)s',
                filemode='w', level=logging.WARNING )
logging.info('Started')
由上述操作生成的日志顶部如下所示:

INFO:root:Started
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.uber.com
DEBUG:requests.packages.urllib3.connectionpool:"GET /v1/estimates/price?end_latitude=39.762239&start_latitude=39.753385&server_token=MY_TOKEN_HERE&start_longitude=-104.998454&end_longitude=-105.013322 HTTP/1.1" 200 None
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.uber.com
DEBUG:requests.packages.urllib3.connectionpool:"GET /v1/estimates/price?
谢谢


Chop

在代码运行时,似乎有东西已经调用了
basicConfig()
。如文档所述,
basicConfig()
如果日志记录配置了任何处理程序,则不会执行任何操作。它只是一种一次性的、简单的配置方法。检查代码中没有张贴在此处的其他部分