Reputation: 9919
Currently I am doing this in my code:
logger = logging.getLogger(__name__)
logger.info("something happened")
Then at the top of my main scripts I do this:
logging.basicConfig(level=logging.INFO)
Problem is that there are too many messages. Is there any way to restrict it to one or a few different loggers?
Upvotes: 5
Views: 141
Reputation: 2804
You can control individual loggers by name. (In your example, you used name, which will be the module name, so each logger will have a different name, module by module). You can use the logging config file to control the logging level of each logger individually. Have a look at the PEP: http://www.python.org/dev/peps/pep-0282/
Upvotes: 2