简体   繁体   中英

Log4j2 JMX custom register

I want to register Log4j2 loggers at my own MBeanServer. But when I called

Server.reregisterMBeansAfterReconfigure()    

method, only logger configs and appenders from property file were registered. But I want to take result like after using HierarchyDynamicMBean in Log4j.

Is anybody encountered this problem?

Thanks, Nikita Koval

if you call Server.reregisterMBeansAfterReconfigure(MBeanServer) , MBeans will be registered in the specified MBeanServer for the following objects:

  • all LoggerContexts available
  • the StatusLogger for each LoggerContext
  • the ContextSelector for each LoggerContext
  • all LoggerConfigs for each LoggerContext
  • all Appenders for each LoggerContext

You mention you are only seeing LoggerConfigs and Appenders. Does that mean that you don't see any LoggerContexts, StatusLoggers and ContextSelectors?

Also, you mention HierarchyDynamicMBean, but I am not sure what it is you want to achieve. If log4j2 had a HierarchyDynamicMBean, what would you do with it? How would you use it?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM