'CMRESHandler' 对象没有属性“_timer”

'CMRESHandler' object has no attribute '_timer'

当我的应用程序启动时,我收到异常“CMRESHandler 'object has no attribute'_timer”。当您启动 CMRESHandler 处理程序以将日志发送到 Elasticsearch 时会发生异常。

该问题仅在本地开发时出现,但当我运行带有Docker的项目时,该错误不会出现。

    handler_es = CMRESHandler(
        hosts=[{"host": KIBANA_SERVER, "port": 443}],
        auth_type=CMRESHandler.AuthType.NO_AUTH,
        use_ssl=True,
        es_index_name="authenticator_server",
        es_additional_fields={"project": "myproject", "environment": ENVIRONMENT},
    )
    handler_es.setFormatter(formatter)
    logger.addHandler(handler_es)

我也遇到过这个问题,我认为是你的主机名有问题。

尝试执行:

sudo hostname localhost

然后 运行 又是这个项目。