How to get the list all existing loggers using python.logging module
up vote
1
down vote
favorite
Is there a way in python to get the list all defined loggers?
I mean, does something that can be used like logging.getAllLoggers() and which would return a list of Logger objects exist?
I searched the python.logging documentation but couldn't find such a method.
Thank you in advance.
python python-3.x logging
add a comment |
up vote
1
down vote
favorite
Is there a way in python to get the list all defined loggers?
I mean, does something that can be used like logging.getAllLoggers() and which would return a list of Logger objects exist?
I searched the python.logging documentation but couldn't find such a method.
Thank you in advance.
python python-3.x logging
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Is there a way in python to get the list all defined loggers?
I mean, does something that can be used like logging.getAllLoggers() and which would return a list of Logger objects exist?
I searched the python.logging documentation but couldn't find such a method.
Thank you in advance.
python python-3.x logging
Is there a way in python to get the list all defined loggers?
I mean, does something that can be used like logging.getAllLoggers() and which would return a list of Logger objects exist?
I searched the python.logging documentation but couldn't find such a method.
Thank you in advance.
python python-3.x logging
python python-3.x logging
asked Nov 11 at 13:38
mistiru
40012
40012
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Loggers are held in a hierarchy by a logging.Manager instance. You could interrogate the Manager on the root logger for the loggers it knows about.
import logging
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
In fact, getting the dict of Logger per name is better than simply a list of Logger alone, sologging.root.manager.loggerDictwas exactly what I was searching for, thank you!
– mistiru
Nov 12 at 14:23
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Loggers are held in a hierarchy by a logging.Manager instance. You could interrogate the Manager on the root logger for the loggers it knows about.
import logging
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
In fact, getting the dict of Logger per name is better than simply a list of Logger alone, sologging.root.manager.loggerDictwas exactly what I was searching for, thank you!
– mistiru
Nov 12 at 14:23
add a comment |
up vote
2
down vote
accepted
Loggers are held in a hierarchy by a logging.Manager instance. You could interrogate the Manager on the root logger for the loggers it knows about.
import logging
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
In fact, getting the dict of Logger per name is better than simply a list of Logger alone, sologging.root.manager.loggerDictwas exactly what I was searching for, thank you!
– mistiru
Nov 12 at 14:23
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Loggers are held in a hierarchy by a logging.Manager instance. You could interrogate the Manager on the root logger for the loggers it knows about.
import logging
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
Loggers are held in a hierarchy by a logging.Manager instance. You could interrogate the Manager on the root logger for the loggers it knows about.
import logging
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
answered Nov 11 at 15:09
Will Keeling
10.2k22329
10.2k22329
In fact, getting the dict of Logger per name is better than simply a list of Logger alone, sologging.root.manager.loggerDictwas exactly what I was searching for, thank you!
– mistiru
Nov 12 at 14:23
add a comment |
In fact, getting the dict of Logger per name is better than simply a list of Logger alone, sologging.root.manager.loggerDictwas exactly what I was searching for, thank you!
– mistiru
Nov 12 at 14:23
In fact, getting the dict of Logger per name is better than simply a list of Logger alone, so
logging.root.manager.loggerDict was exactly what I was searching for, thank you!– mistiru
Nov 12 at 14:23
In fact, getting the dict of Logger per name is better than simply a list of Logger alone, so
logging.root.manager.loggerDict was exactly what I was searching for, thank you!– mistiru
Nov 12 at 14:23
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249304%2fhow-to-get-the-list-all-existing-loggers-using-python-logging-module%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown