Java JMX PlatformLoggingMXBean
JMX Java About 621 words功能
PlatformLoggingMXBean
可以获取Java
服务的运行时的日志级别和名称
代码
public class PlatformLoggingMXBeanTest {
public static void main(String[] args) {
PlatformLoggingMXBean platformLoggingMXBean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
for (String loggerName : platformLoggingMXBean.getLoggerNames()) {
System.out.println(loggerName);
System.out.println(platformLoggingMXBean.getLoggerLevel(loggerName));
System.out.println("---------------------");
}
}
}
输出:如果在Spring Boot
项目中,输出的内容会更多
INFO
---------------------
global
---------------------
Views: 604 · Posted: 2024-01-10
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...