jahar created ZOOKEEPER-3070:
--------------------------------
Summary: Not Able to Change Zookeeper Logging via JMX Call
Key: ZOOKEEPER-3070
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3070
Project: ZooKeeper
Issue Type: Improvement
Components: jmx
Affects Versions: 3.4.5
Environment: Using Java 8 for writing standalone code to update the
MBeans in zookeeper which is running in Windows machine for POC purpose.
Zookeeper Version is : 3.4.5
Reporter: jahar
Attachments: jconsole.JPG, zkpg.JPG
Hi,
I wanted to change the logging level of zookeeper dynamically via a JMX call
programmatically. Apache Zookeeper official page specifies that it is possible
to change the Mbeans via JMX calls and I have verified this through JConsole
also.
!zkpg.JPG!
But the problem is that I am not able to update the Mbeans related to log4j
through my code. I do see an API which can be used to access the Mbeans related
to Object "org.apache.ZooKeeperService:name0=StandaloneServer_port-1" below is
the screengrab of Jconsole and my code:
!jconsole.JPG!
Here goes my Code:
{quote}public static void main(String[] args) throws Exception
{
JMXServiceURL url = new
JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:2167/jmxrmi");
JMXConnector jmxConnector = JMXConnectorFactory.connect(url);
MBeanServerConnection mbeanServerConnection =
jmxConnector.getMBeanServerConnection();
ObjectName mbeanName = new
ObjectName("org.apache.ZooKeeperService:name0=StandaloneServer_port-1");
ZooKeeperServerMXBean newProxyInstance =
MBeanServerInvocationHandler.newProxyInstance(mbeanServerConnection,
mbeanName, ZooKeeperServerMXBean.class, true);
System.out.println(newProxyInstance.getClientPort());
}
{quote}
I dont see any API which can be used to access and update the log4J Mbeans e.g.
"root". What I want to achieve is to update the logging of zookeeper without
taking a restart.
Please advice if some API is exposed to achieve this.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)