简体   繁体   中英

Removing JGroups startup message : GMS

On startup JGroups 2.7.0. GA writes to System.out a message along the lines of:

---------------------------------------------------------
GMS: address is 10.0.3.35:48641 (cluster=blabla)
---------------------------------------------------------

I want to either suppress it or redirect it using Log4j ( which the rest of the framework uses ).

Ideas?


I don't want to redirect System.out by itself since that usually causes more trouble than it's worth.

You can suppress the printing of the GMS address by setting in your XML

<pbcast.GMS print_local_addr="false" ...>

Works on JGroups 2.5.1 as well.

This is how i managed to do print GMS string to logs.

First disable

<pbcast.GMS print_local_addr="false"> 

then,

String clusterName = channel.getClusterName();
String clusterAddress = channel.getAddressAsString();
String localAddress = channel.getProtocolStack()
        .dumpStats()
        .get("UDP")
        .get("local_physical_address")
        .toString();

StringBuilder border = new StringBuilder();
String GMS = String.format("GMS: address=%s, cluster=%s, physical address=%s", 
        clusterAddress, 
        clusterName, 
        localAddress
);
logger.info("{}", GMS);

Works with 4.2.3.Final version.

You can't redirect System.out to log4j that makes no sense. After all how would log4j print anything ? It would get stuck in a loop.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM