Logging in JGroups
Refer to Logging for more information on how to enable logging if JGroups is used inside of JBoss
at the TRACE level gives a lot of information, so make sure you have rolling logs configured. JGroups by default uses commons-logging, so both log4j and JDK logging can be used.
The following categories can be enabled separately to reduce the log size:
Logs JOINs, LEAVES, view creation
Initial discovery of members, used for JOIN
For point-to-point communication
For multipoint communication
Based on heartbeats
Based on TCP connections
Dynamically changing log levels
By default JGroups logs only warnings, errors and fatal messages. However, sometimes it is necessary to change the log level of a logger at runtime, e.g. when a system is hung and we don't want to shut it down so we can diagnose what went wrong.
Since JGroups 2.8, this can be done on any protocol by calling <Protocol>setLevel(String level). This method is exposed via JMX on every protocol as an attribute.
As an example, when we suspect NAKACK is the culprit, we can start jconsole and connect to the running process. Then pick the correct channel and show all protocols associated with that channel. Pick NAKACK and look at the attributes.
Change attribute 'level' to TRACE. This will log all messages for org.jgroups.protocols.pbcast.NAKACK at the TRACE level. Note that you needs to have an appender configured, if there is no appender, nothing will happen.