File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -534,6 +534,22 @@ subclasses. However, the :meth:`__init__` method in subclasses needs to call
534
534
is intended to be implemented by subclasses and so raises a
535
535
:exc: `NotImplementedError `.
536
536
537
+ .. warning :: This method is called after a handler-level lock is acquired, which
538
+ is released after this method returns. When you override this method, note
539
+ that you should be careful when calling anything that invokes other parts of
540
+ the logging API which might do locking, because that might result in a
541
+ deadlock. Specifically:
542
+
543
+ * Logging configuration APIs acquire the module-level lock, and then
544
+ individual handler-level locks as those handlers are configured.
545
+
546
+ * Many logging APIs lock the module-level lock. If such an API is called
547
+ from this method, it could cause a deadlock if a configuration call is
548
+ made on another thread, because that thread will try to acquire the
549
+ module-level lock *before * the handler-level lock, whereas this thread
550
+ tries to acquire the module-level lock *after * the handler-level lock
551
+ (because in this method, the handler-level lock has already been acquired).
552
+
537
553
For a list of handlers included as standard, see :mod: `logging.handlers `.
538
554
539
555
.. _formatter-objects :
You can’t perform that action at this time.
0 commit comments