def reload_config(self, config: Dict[str, Any]) -> None:
        """Apply log related configuration.

        .. note::
            It is also able to deal with runtime configuration changes.

        :param config: ``log`` section from Patroni configuration.
        """
        if self._config is None or not deep_compare(self._config, config):
            with self._queue_handler.queue.mutex:
                self._queue_handler.queue.maxsize = config.get('max_queue_size', self.DEFAULT_MAX_QUEUE_SIZE)

            self._root_logger.setLevel(config.get('level', PatroniLogger.DEFAULT_LEVEL))
            if config.get('traceback_level', PatroniLogger.DEFAULT_TRACEBACK_LEVEL).lower() == 'debug':
                # show stack traces only if ``log.traceback_level`` is ``DEBUG``
                logging.Logger.exception = debug_exception
            else:
                # show stack traces as ``ERROR`` log messages
                logging.Logger.exception = error_exception

            handler = self.log_handler

            if 'dir' in config:
                mode = parse_int(config.get('mode'))
                if not isinstance(handler, PatroniFileHandler):
                    handler = PatroniFileHandler(os.path.join(config['dir'], __name__), mode)
                handler.set_log_file_mode(mode)
                max_file_size = int(config.get('file_size', 25000000))
                handler.maxBytes = max_file_size  # pyright: ignore [reportAttributeAccessIssue]
                handler.backupCount = int(config.get('file_num', 4))
            # we can't use `if not isinstance(handler, logging.StreamHandler)` below,
            # because RotatingFileHandler and PatroniFileHandler are children of StreamHandler!!!
            elif handler is None or isinstance(handler, PatroniFileHandler):
                handler = logging.StreamHandler()

            is_new_handler = handler != self.log_handler

            if (self._is_config_changed(config) or is_new_handler) and handler:
                formatter = self._get_formatter(config)
                handler.setFormatter(formatter)

            if is_new_handler:
                with self.log_handler_lock:
                    if self.log_handler:
                        self._old_handlers.append(self.log_handler)
                    self.log_handler = handler

            self._config = config.copy()
            self.update_loggers(config.get('loggers') or {})
Apply log related configuration.

        .. note::
            It is also able to deal with runtime configuration changes.

        :param config: ``log`` section from Patroni configuration.
        
patroni/log.py