场景: python + aliyun-log-python-sdk
向SLS写日志用的handler [handler_slsHandler] class=aliyun.log.QueuedLogHandler level=DEBUG formatter=rawFormatter
在测试环境上一切正常,领导担心部署到线上后,如果向SLS写日志异常了,会不会影响python程序的正常运行。
比如,handler_slsHandler抛异常,业务流程就会被未捕获的异常中断。
免费的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": "**"}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。