# 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.

Reply via email to