Posts

Showing posts from September, 2012

JMX log all or specific MBeans and all or specific values

  private static Log Log = LogFactory.getLog(LogMBean.class);   public void LogMBeans(String nameContains, String valueContains) throws IntrospectionException,       InstanceNotFoundException, ReflectionException   {     final List servers = new LinkedList ();     servers.add(ManagementFactory.getPlatformMBeanServer());     servers.addAll(MBeanServerFactory.findMBeanServer(null));     for (final MBeanServer server: servers)     {       Log.error("Server: " + server.getClass().getName());       final Set mbeans = new HashSet ();       mbeans.addAll(server.queryNames(null, null));       for (final ObjectName mbean: mbeans)       {         if (nameContains != null && mbean.toString().contains(nameContains) == false)         {           contin...