有没有办法使用Django日志记录过滤特定的错误消息?例如不可压缩的fileerror
有没有办法使用Django日志记录过滤特定的错误消息?例如,无法压缩的FileError
希望停止将这些错误发送到Sentry.io
Is there a way to filter out specific error messages using Django Logging? eg UncompressableFileError
Would like to stop these errors being sent to Sentry.io
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在Sentry处理程序上设置
过滤器
,该操作人员检查要过滤出来的错误类型,然后返回false
将其丢弃。粗略:然后
可能需要根据字符串的发生位置进行调整 -
You can set a
Filter
on the Sentry handler which checks for the type of errors you want to filter out, and returnFalse
to drop them. Roughly:and then
This might need to be tweaked depending on where the string occurs - e.g. in message or traceback
最终从SA上的另一个答案中找到了这一点,该答案与Raven合作:
有没有一种方法可以使用Django日志记录过滤特定的错误消息?例如,不可压制的fileerror
Found this in the end from another answer on SA which works with Raven:
Is there a way to filter out specific error messages using Django Logging? eg UncompressableFileError