Question

I've got a JGroups setup with more than one JGroups protocol stack (e.g. one for the application server, here JBoss EAP5, and one for a custom application).

I'm looking to set a JGroups's Protocol log Level to a given level, but for a given protocol instance only, not for the global logger. I.e. I want to set the log level but only for a protocol stack, not for the other protocol stack. This is used for debugging of my custom application JGroups protocol stack.

I started to set the log level globally for a given protocol in the logging configuration (log4j), but this is be active for all protocol stacks. Thus, a lot of logging messages are produced.

Then I tried a finer approach: the superclass of all JGroups protocol Protocol has a method setLevel which can be used to set the logging level (which can be configured either programatically or through XML configuration file). Since Protocol.setLevel(String) is available only from JGroups 2.8.0, I isolated the EAR classloader in order to override the JGroups 2.6.20 from the JBoss EAP5 server. But the effect is the same as with the global configuration: the log level is set for all protocol stacks.

Is there a way to configure JGroups logging level for a given Protocol for a given ProtocolStack ? If yes, how to do it ?

Was it helpful?

Solution

You can't do it, because the logger is tied to the class name, not to the classloader.

However, there are some workarounds:

  • Add a <TRACE/> or <HDRS/> protocol on bottom of your protocol stack in the jgroups.xml configuration file (i.e. at the end of the file): this will display any Event sent to the up or down protocol on System.out.
  • Set the print_local_addr attribute to true in the GMS protocol: this will display the local address on System.out.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top