eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
847 stars 350 forks source link

How to silence ddsi_log, such as from GVERROR #1954

Open ipa-rwu opened 5 months ago

ipa-rwu commented 5 months ago

Hi,

How to silence ddsi_log, such as from GVERROR? I am using peer to peer communication. Sometimes the peer is not exiting. Then I will get a lot of error such as

[hi-3] 1711449232.936507 [42]        tev: ddsi_udp_conn_write to udp/172.20.0.7:17922 failed with retcode -3

I would like to silence it.

eboasson commented 5 months ago

I'd almost think that printing it to stderr can't be turned off via the configuration 🧐 That's something I need to fix.

There is a workaround:

#include "dds/ddsrt/log.h"

static void nullsink (void *p, const dds_log_data_t *d)
{
  (void)p;
  (void)d;
}

main() {
  dds_set_log_sink (nullsink, NULL);
  dds_create_participant(...);
}

should do the trick (I checked with a hacked version of ddsperf).