本文整理了Java中org.apache.log4j.jmx.HierarchyDynamicMBean.addLoggerMBean()
方法的一些代码示例,展示了HierarchyDynamicMBean.addLoggerMBean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HierarchyDynamicMBean.addLoggerMBean()
方法的具体详情如下:
包路径:org.apache.log4j.jmx.HierarchyDynamicMBean
类名称:HierarchyDynamicMBean
方法名:addLoggerMBean
暂无
代码示例来源:origin: log4j/log4j
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: log4j/log4j
public
void postRegister(java.lang.Boolean registrationDone) {
log.debug("postRegister is called.");
hierarchy.addHierarchyEventListener(this);
Logger root = hierarchy.getRootLogger();
addLoggerMBean(root);
}
代码示例来源:origin: log4j/log4j
public
Object invoke(String operationName,
Object params[],
String signature[]) throws MBeanException,
ReflectionException {
if (operationName == null) {
throw new RuntimeOperationsException(
new IllegalArgumentException("Operation name cannot be null"),
"Cannot invoke a null operation in " + dClassName);
}
// Check for a recognized operation name and call the corresponding operation
if(operationName.equals("addLoggerMBean")) {
return addLoggerMBean((String)params[0]);
} else {
throw new ReflectionException(
new NoSuchMethodException(operationName),
"Cannot find the operation " + operationName + " in " + dClassName);
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
/**
* Register the log4j JMX mbeans. Set environment variable
* "zookeeper.jmx.log4j.disable" to true to disable registration.
* @see http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/jmx/package-summary.html
* @throws JMException if registration fails
*/
@SuppressWarnings("rawtypes")
public static void registerLog4jMBeans() throws JMException {
if (Boolean.getBoolean("zookeeper.jmx.log4j.disable") == true) {
return;
}
MBeanServer mbs = MBeanRegistry.getInstance().getPlatformMBeanServer();
// Create and Register the top level Log4J MBean
HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
ObjectName mbo = new ObjectName("log4j:hiearchy=default");
mbs.registerMBean(hdm, mbo);
// Add the root logger to the Hierarchy MBean
Logger rootLogger = Logger.getRootLogger();
hdm.addLoggerMBean(rootLogger.getName());
// Get each logger from the Log4J Repository and add it to
// the Hierarchy MBean created above.
LoggerRepository r = LogManager.getLoggerRepository();
Enumeration enumer = r.getCurrentLoggers();
Logger logger = null;
while (enumer.hasMoreElements()) {
logger = (Logger) enumer.nextElement();
hdm.addLoggerMBean(logger.getName());
}
}
代码示例来源:origin: azkaban/azkaban
private void configureMBeanServer() {
logger.info("Registering MBeans...");
this.mbeanServer = ManagementFactory.getPlatformMBeanServer();
registerMbean("jetty", new JmxJettyServer(this.server));
registerMbean("triggerManager", new JmxTriggerManager(this.triggerManager));
if (this.executorManagerAdapter instanceof ExecutorManager) {
registerMbean("executorManager",
new JmxExecutorManager((ExecutorManager) this.executorManagerAdapter));
} else if (this.executorManagerAdapter instanceof ExecutionController) {
registerMbean("executionController", new JmxExecutionController((ExecutionController) this
.executorManagerAdapter));
}
// Register Log4J loggers as JMX beans so the log level can be
// updated via JConsole or Java VisualVM
final HierarchyDynamicMBean log4jMBean = new HierarchyDynamicMBean();
registerMbean("log4jmxbean", log4jMBean);
final ObjectName accessLogLoggerObjName =
log4jMBean.addLoggerMBean(AZKABAN_ACCESS_LOGGER_NAME);
if (accessLogLoggerObjName == null) {
logger.info(
"************* loginLoggerObjName is null, make sure there is a logger with name "
+ AZKABAN_ACCESS_LOGGER_NAME);
} else {
logger.info("******** loginLoggerObjName: "
+ accessLogLoggerObjName.getCanonicalName());
}
}
代码示例来源:origin: apache/log4j
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: apache/log4j
public
void postRegister(java.lang.Boolean registrationDone) {
log.debug("postRegister is called.");
hierarchy.addHierarchyEventListener(this);
Logger root = hierarchy.getRootLogger();
addLoggerMBean(root);
}
代码示例来源:origin: apache/log4j
public
Object invoke(String operationName,
Object params[],
String signature[]) throws MBeanException,
ReflectionException {
if (operationName == null) {
throw new RuntimeOperationsException(
new IllegalArgumentException("Operation name cannot be null"),
"Cannot invoke a null operation in " + dClassName);
}
// Check for a recognized operation name and call the corresponding operation
if(operationName.equals("addLoggerMBean")) {
return addLoggerMBean((String)params[0]);
} else {
throw new ReflectionException(
new NoSuchMethodException(operationName),
"Cannot find the operation " + operationName + " in " + dClassName);
}
}
代码示例来源:origin: org.apache/log4j
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: apache-log4j/log4j
public
ObjectName addLoggerMBean(String name) {
Logger cat = LogManager.exists(name);
if(cat != null) {
return addLoggerMBean(cat);
} else {
return null;
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
public
void postRegister(java.lang.Boolean registrationDone) {
log.debug("postRegister is called.");
hierarchy.addHierarchyEventListener(this);
Logger root = hierarchy.getRootLogger();
addLoggerMBean(root);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public
void postRegister(java.lang.Boolean registrationDone) {
log.debug("postRegister is called.");
hierarchy.addHierarchyEventListener(this);
Logger root = hierarchy.getRootLogger();
addLoggerMBean(root);
}
代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager
public
void postRegister(java.lang.Boolean registrationDone) {
log.debug("postRegister is called.");
hierarchy.addHierarchyEventListener(this);
Logger root = hierarchy.getRootLogger();
addLoggerMBean(root);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j
public
void postRegister(java.lang.Boolean registrationDone) {
log.debug("postRegister is called.");
hierarchy.addHierarchyEventListener(this);
Logger root = hierarchy.getRootLogger();
addLoggerMBean(root);
}
代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j
public
void postRegister(java.lang.Boolean registrationDone) {
log.debug("postRegister is called.");
hierarchy.addHierarchyEventListener(this);
Logger root = hierarchy.getRootLogger();
addLoggerMBean(root);
}
内容来源于网络,如有侵权,请联系作者删除!