I'm trying to get a list of logger names that have already been created. I saw a few similar questions on here but none of the answers produced the output I wanted. I want the list of names that you can use to call, logging.getLogger(name)
Thus the list would be...
* name1
* name2
* name3
Two things I have tried via the other questions..
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]- Output -
Logger name1 (DEBUG)>, <Logger name2 (DEBUG) - This is the closest one as it contains the name within it
- Output -
loggers = logging.getLogger().manager.loggerDict.keys()- Output -
generator object RsyncProcessing.start_new_filelist_update_process.<locals>.<genexpr> at 0x7fd193d43650
- Output -
The reason I need just the list of names is because my program will run continuously and I only need to set up a new log if the log does not already exist. Therefore, I would write...
if name in loggers:
break
else:
make_new_log