aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Lib/logging/config.py
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-07-08 15:54:05 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-07-08 15:54:05 +0000
commitfc7be18c76af2e700641f3598c4856baeef1428e (patch)
tree11dbca45eb321c3a4dd08b12152acc6ef5dd3fa9 /contrib/tools/python3/Lib/logging/config.py
parentec0e7ed6da6fb317741fd8468602949a1362eca5 (diff)
parentc92cb9d3a19331916f0c274d80e67f02a62caa9b (diff)
downloadydb-fc7be18c76af2e700641f3598c4856baeef1428e.tar.gz
Merge branch 'rightlib' into mergelibs-240708-1553
Diffstat (limited to 'contrib/tools/python3/Lib/logging/config.py')
-rw-r--r--contrib/tools/python3/Lib/logging/config.py48
1 files changed, 27 insertions, 21 deletions
diff --git a/contrib/tools/python3/Lib/logging/config.py b/contrib/tools/python3/Lib/logging/config.py
index 33417b75d5..1824d0aa74 100644
--- a/contrib/tools/python3/Lib/logging/config.py
+++ b/contrib/tools/python3/Lib/logging/config.py
@@ -732,16 +732,16 @@ class DictConfigurator(BaseConfigurator):
def _configure_queue_handler(self, klass, **kwargs):
if 'queue' in kwargs:
- q = kwargs['queue']
+ q = kwargs.pop('queue')
else:
q = queue.Queue() # unbounded
- rhl = kwargs.get('respect_handler_level', False)
- if 'listener' in kwargs:
- lklass = kwargs['listener']
- else:
- lklass = logging.handlers.QueueListener
- listener = lklass(q, *kwargs.get('handlers', []), respect_handler_level=rhl)
- handler = klass(q)
+
+ rhl = kwargs.pop('respect_handler_level', False)
+ lklass = kwargs.pop('listener', logging.handlers.QueueListener)
+ handlers = kwargs.pop('handlers', [])
+
+ listener = lklass(q, *handlers, respect_handler_level=rhl)
+ handler = klass(q, **kwargs)
handler.listener = listener
return handler
@@ -768,26 +768,32 @@ class DictConfigurator(BaseConfigurator):
klass = cname
else:
klass = self.resolve(cname)
- if issubclass(klass, logging.handlers.MemoryHandler) and\
- 'target' in config:
- # Special case for handler which refers to another handler
- try:
- tn = config['target']
- th = self.config['handlers'][tn]
- if not isinstance(th, logging.Handler):
- config.update(config_copy) # restore for deferred cfg
- raise TypeError('target not configured yet')
- config['target'] = th
- except Exception as e:
- raise ValueError('Unable to set target handler %r' % tn) from e
+ if issubclass(klass, logging.handlers.MemoryHandler):
+ if 'flushLevel' in config:
+ config['flushLevel'] = logging._checkLevel(config['flushLevel'])
+ if 'target' in config:
+ # Special case for handler which refers to another handler
+ try:
+ tn = config['target']
+ th = self.config['handlers'][tn]
+ if not isinstance(th, logging.Handler):
+ config.update(config_copy) # restore for deferred cfg
+ raise TypeError('target not configured yet')
+ config['target'] = th
+ except Exception as e:
+ raise ValueError('Unable to set target handler %r' % tn) from e
elif issubclass(klass, logging.handlers.QueueHandler):
# Another special case for handler which refers to other handlers
# if 'handlers' not in config:
# raise ValueError('No handlers specified for a QueueHandler')
if 'queue' in config:
from multiprocessing.queues import Queue as MPQueue
+ from multiprocessing import Manager as MM
+ proxy_queue = MM().Queue()
+ proxy_joinable_queue = MM().JoinableQueue()
qspec = config['queue']
- if not isinstance(qspec, (queue.Queue, MPQueue)):
+ if not isinstance(qspec, (queue.Queue, MPQueue,
+ type(proxy_queue), type(proxy_joinable_queue))):
if isinstance(qspec, str):
q = self.resolve(qspec)
if not callable(q):