简体   繁体   中英

Getting filename from Logger object in Python

我需要一种方法来检索python 3.4.2 Logger对象“ mylogger”指向的“文件名”。

for i in range(0, len(mylogger.handlers)):
    try:
        print(mylogger.handlers[i].baseFilename)
    except AttributeError:
        print('no to file')

mylogger can send logs to several files as well to stdout or to an email address

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM