Hi, I think that when you configure the logging, the exception is logged when the program terminates as the exception was never retrieved explicitly. When you don't configure the logging system, the exception is still logged, but not printed as the logger is not told to do so.
wait() returns a pair of lists containing the tasks that finished and those which are still pending (as described in the doc: https://docs.python.org/3/library/asyncio-task.html#asyncio.wait). since by default wait returns only when ALL_COMPLETED, the list of pending tasks should be empty, while the list of done tasks should contain the result of the call to sync(). With only one coroutine you can simply call : loop.run_until_complete(sync()) or even: loop.run_until_complete(asyncio.wait_for(sync())) # wait_for is useful if you want to set a timeout, for instance but if you need wait(), you will have to inspect the result yourself: done, pending = loop.run_until_complete(asyncio.wait([sync()])) for task in done: done.result() # will raise the exception 2016-09-19 12:00 GMT+02:00 hilo jack <a132...@gmail.com>: > # python >= 3.5.0 > > import asyncio > import time > from os.path import exists > > import logging > import logging.config > > conf = ''' > [loggers] > keys=root > > [logger_root] > level=DEBUG > handlers=hand01 > > [handlers] > keys=hand01 > > [handler_hand01] > class=StreamHandler > args=(sys.stdout,) > formatter=form01 > > [formatters] > keys=form01 > > [formatter_form01] > format=%(asctime)s %(filename)s +%(lineno)d %(levelname)s %(message)s > datefmt=%a, %d %b %Y %H:%M:%S > > ''' > > if not exists('log.conf'): > open('log.conf', 'w').write(conf) > print('Initialize log.conf.....') > quit('Try again please.'); > > logging.config.fileConfig("log.conf") > > > async def sync(): > print("No exception raise "); > t=undefined.func() > print("Not work"); > > asyncio.get_event_loop().run_until_complete(asyncio.wait([sync()])) > > > This program above will not produce exception. > > If you remove `logging.config.fileConfig("log.conf")` , asyncio.wait would > raise exception. > > My quesion is: > > 1. Why asyncio does not raise up exception when using > `logging.config.fileConfig` > > 2. How to debug `asyncio.wait` if there is no exception raised. > > -- Martin <http://www.martiusweb.net> Richard www.martiusweb.net