我将 HikariCP 与 Tomact8.5 和 Oracle 一起使用。
我想在每次 HikariCP 警告泄漏时发送电子邮件。
HikariCP 代码:
import org.slf4j.Logger;
LOGGER.warn("{} - leakDetectionThreshold is less than 2000ms or more than maxLifetime, disabling it.", poolName);
我应该编写自己的代码还是可以使用日志记录属性来获取通过邮件发送的警告?
最佳答案
Should I write my own code or can I use logging properties to get warning in mail?
假设您使用 JUL 作为 slf4j 的后端,您可以按照 sending errors and exceptions through emails in apache tomact server start 中的说明进行操作。如果您想设置logging.properties
。
如果您只想看到该警告,则必须找出用于将处理程序附加到正确位置的 JUL 记录器名称,否则您将编写并安装 custom filter对于该特定警告。
关于java - 当 HikariCP 警告泄漏时发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44994770/