开发者社区> 问答> 正文

阿里云SLS日志服务,如果slsHandler写失败,会影响程序运行么

场景: python + aliyun-log-python-sdk

向SLS写日志用的handler [handler_slsHandler] class=aliyun.log.QueuedLogHandler level=DEBUG formatter=rawFormatter

在测试环境上一切正常,领导担心部署到线上后,如果向SLS写日志异常了,会不会影响python程序的正常运行。

比如,handler_slsHandler抛异常,业务流程就会被未捕获的异常中断。

展开
收起
catcko2zt5av6 2021-05-14 11:20:20 998 0
1 条回答
写回答
取消 提交回答
  • 免费的SLS服务到期了,正好可以用来验证这个问题,验证结果: 1、业务流程正常 2、写本地文件的日志还能正常记录 3、每次logger调用,都会在本地日志文件内出现如下内容 --- Logging error --- Traceback (most recent call last): File "/opt//.venv/lib/python3.6/site-packages/aliyun/log/logger_hanlder.py", line 484, in _post self.send(req) File "/opt/*****/.venv/lib/python3.6/site-packages/aliyun/log/logger_hanlder.py", line 189, in send return self.client.put_logs(req) File "/opt//.venv/lib/python3.6/site-packages/aliyun/log/logclient.py", line 483, in put_logs (resp, header) = self._send('POST', project, compress_data, resource, params, headers) File "/opt/****/.venv/lib/python3.6/site-packages/aliyun/log/logclient.py", line 326, in _send return self._sendRequest(method, url, params2, body, headers2, respons_body_type) File "/opt/*/.venv/lib/python3.6/site-packages/aliyun/log/logclient.py", line 280, in _sendRequest resp_status, resp_header, resp_body) aliyun.log.logexception.LogException: {"errorCode": "ProjectForbidden", "errorMessage": "project ***** has been forbidden", "requestId": "**"}

    2021-05-18 11:22:20
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
PostgresChina2018_赖思超_PostgreSQL10_hash索引的WAL日志修改版final 立即下载
Kubernetes下日志实时采集、存储与计算实践 立即下载
日志数据采集与分析对接 立即下载