Root logger in dictconfig

I want to configure a Sentry logger for a Django project. I define a sentry handler and put this handler in the root log with the error level.

According to the documentation of the logging module, there is a special root key:

root - this will be the root registrar configuration. The configuration processing will be the same as for any registrar, except that the propagate parameter will not be applied.

At the same time, in other places where the log with the name '' is stored, contains the configuration for the root logger.

Does this have the same effect? Which is preferable?

 >>> import logging >>> logging.getLogger('') is logging.root True >>> 
+9
python django logging sentry
Nov 28 '13 at 6:14
source share
1 answer

In any case, it will work, because the registrar with the name '' is the root registrar. Specifying the root key of the top level clarifies what you do if you configure many registrars - the registrar configuration '' may be lost in the group of others, while the root key is adjacent to the loggers key and so (in theory) should be allocated more.

Again, a key called root is a top-level key; it is not under loggers .

+9
Nov 28 '13 at 8:51
source share



All Articles