...
JMX can be used to receive Geode severe, error or warning log messages as alerts as well as to access GatewaySenderMBean and GatewayReceiverMBean attributes
Alerts
Configure Alert Level
JMX clients can be configured to receive Geode severe, error or warning log messages as alerts using a JMX NotificationListener.
...
Here are examples of modifying the alert level using JConsole and Java.
JConsole
To view the alert level:
To change the alert level:
Java
The attached AlertNotificationListener JMX client changes the alert level using code like:
Code Block | ||
---|---|---|
| ||
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://localhost/jndi/rmi://localhost:1092/jmxrmi"); JMXConnector jmxConnector = JMXConnectorFactory.connect(url); MBeanServerConnection mbs = jmxConnector.getMBeanServerConnection(); ObjectName distributedSystem = new ObjectName("GemFire:service=System,type=Distributed"); mbs.invoke(distributedSystem, "changeAlertLevel", new String[] {"warning"}, new String[] {"java.lang.String"}) |
Notifications
Once the alert level has been set to 'warning', then warning log messages will be received by any NotificationListenerany JMX NotificationListener in the form of Notifications.
Here are some example using JConsole and Java.
JConsole
Java
The attached AlertNotificationListener JMX client handles Notifications using code like:
...
Note: This example logs every Geode warning, not just ones from GatewaySenders.
GatewaySender Warnings of Interest
MBean Attributes
JMX clients can also access GatewaySenderMBean and GatewayReceiverMBean attributes.
...