title: How to avoid Broadcast messages from syslog printed on the console
body: <p>I have a written a small code to send messages to syslog using C Api's when there is failure to connect to postgres database.</p>
  
  <pre><code>int main ( int argc, char **argv )
  {
          PGconn *psql;
          PGresult *res;
          int flag = 0;
  
          openlog ( "postgres", LOG_NDELAY, LOG_SYSLOG );
  
          psql = PQconnectdb("hostaddr = '127.0.0.0' port = '5432' dbname = 'RtpDb' user = 'rtp_user_99' password = 'rtp_user' connect_timeout = '10'");
          if ( PQstatus(psql) != CONNECTION_OK )
          {
             //Send an event to syslog for DB Connection Failure
             syslog (LOG_EMERG, "%s", PQerrorMessage(psql) )
          }
         closelog ();
         PQclear(res);
         PQfinish(psql);
  }
  </code></pre>
  
  <p>When there is a connection failure to postgres database the messages are printed on to the console even though the option LOG_CONS is not enabled in openlog.</p>
  
  <pre><code>Broadcast message from systemd-journald@blr09 (Tue 2017-01-03 05:24:46 EST):
  postgres[40933]: could not connect to server: Network is unreachable
          Is the server running on host "127.0.0.0" and accepting
          TCP/IP connections on port 5432?
  Message from syslogd@blr09 at Jan  3 05:24:46 ...
   postgres:could not connect to server: Network is unreachable#012#011Is the server running on host "127.0.0.0" and accepting#012#011TCP/IP connections on port 5432?
  </code></pre>
  
  <p>Could you please help me how to avoid the messages being printed on the console.</p>