gpt4 book ai didi

kubernetes - 防止从 Kubernetes pod 停止日志记录

转载 作者:行者123 更新时间:2023-12-03 13:10:40 24 4
gpt4 key购买 nike

考虑一个升级的 Kubernetes 部署,当旧 pod 停止并重新启动时。我们有运行 tomcat 的 pod,连接到 MySQL 数据库。

一旦 tomcat 收到停止命令,它就会开始停止应用程序。但是,仍然有任务在运行,失去与数据库的连接会导致抛出大量异常。没关系,因为应用程序不再执行任何操作。我的问题是,这会以 fatal error “垃圾邮件”我们的日志,并且很难区分哪些异常是相关的,哪些只是由应用程序停止引起的。

其中一个异常(exception)是:

java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [sun.reflect.NativeMethodAccessorImpl]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

有没有办法阻止记录此类异常?发送停止信号后是否可以立即停止记录?

最佳答案

您应该使用诸如 fluentd 之类的工具来管理您的日志记录,然后使用 exclude filter对于您的异常日志。 kubernetes 或容器引擎无法过滤标准输出上显示的内容。

关于kubernetes - 防止从 Kubernetes pod 停止日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52007220/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com