Logging 如何使用Jboss LogManager和SLF4J获取已配置记录器的列表?
我使用JBoss EAP6.0,SLF4J作为我的日志外观,JBoss logmanager作为后端日志实现。正在显示日志记录语句,但我无法使用org.jboss.logmanager或PlatformLoggingMXBean获取已配置日志记录程序的列表。两个列表都是空的 这是我的密码:Logging 如何使用Jboss LogManager和SLF4J获取已配置记录器的列表?,logging,slf4j,jboss-eap-6,jboss-logging,Logging,Slf4j,Jboss Eap 6,Jboss Logging,我使用JBoss EAP6.0,SLF4J作为我的日志外观,JBoss logmanager作为后端日志实现。正在显示日志记录语句,但我无法使用org.jboss.logmanager或PlatformLoggingMXBean获取已配置日志记录程序的列表。两个列表都是空的 这是我的密码: Enumeration<String> loggerNames = LogManager.getLogManager().getLoggerNames(); while(loggerNames.h
Enumeration<String> loggerNames = LogManager.getLogManager().getLoggerNames();
while(loggerNames.hasMoreElements()){
System.out.println("lm logger names: " + loggerNames.nextElement());
}
PlatformLoggingMXBean loggingMxBean = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
List<String> loggerNames = loggingMxBean.getLoggerNames();
for(String logger : loggerNames) {
System.out.println(logger);
}
枚举loggerNames=LogManager.getLogManager().getLoggerNames();
while(loggerNames.hasMoreElements()){
System.out.println(“lm记录器名称:+loggerNames.nextElement());
}
PlatformLoggingMXBean loggingMxBean=ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class);
List loggerNames=loggingMxBean.getLoggerNames();
用于(字符串记录器:loggerNames){
系统输出打印LN(记录器);
}
jboss logmanager不支持logmanager.getLogManager().getLoggerNames()
。您使用的是什么JDK版本?另外,纯粹出于好奇,你为什么要列出它们?再看一眼,我想这是一个愚蠢的问题,因为你正在使用平台loggingMXBean
。有一个JIRA来增加对这一点的支持。