]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Logging improvements
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 28 Mar 2017 17:12:27 +0000 (18:12 +0100)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:55:46 +0000 (17:55 +0000)
servers/lloadd/client.c
servers/lloadd/operation.c
servers/lloadd/upstream.c

index c8c41cb79e534249220b5499927daddb80e95604..7c4b1eccb37cd8e44f861180513b80fd5367b4f7 100644 (file)
@@ -42,7 +42,8 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
 
     ber = c->c_currentber;
     if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
-        Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n" );
+        Debug( LDAP_DEBUG_ANY, "client_read_cb: "
+                "ber_alloc failed\n" );
         goto fail;
     }
 
@@ -52,8 +53,9 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
 
         if ( err != EWOULDBLOCK && err != EAGAIN ) {
             char ebuf[128];
-            Debug( LDAP_DEBUG_ANY, "ber_get_next on fd %d failed errno=%d (%s)\n", c->c_fd,
-                    err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
+            Debug( LDAP_DEBUG_ANY, "client_read_cb: "
+                    "ber_get_next on fd %d failed errno=%d (%s)\n",
+                    c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
 
             c->c_currentber = NULL;
             goto fail;
@@ -67,7 +69,8 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
 
     op = operation_init( c, ber );
     if ( !op ) {
-        Debug( LDAP_DEBUG_ANY, "operation_init failed\n" );
+        Debug( LDAP_DEBUG_ANY, "client_read_cb: "
+                "operation_init failed\n" );
         goto fail;
     }
 
@@ -134,7 +137,8 @@ client_init(
 
     event = event_new( base, s, EV_READ|EV_PERSIST, client_read_cb, c );
     if ( !event ) {
-        Debug( LDAP_DEBUG_ANY, "Read event could not be allocated\n" );
+        Debug( LDAP_DEBUG_ANY, "client_init: "
+                "Read event could not be allocated\n" );
         goto fail;
     }
     event_add( event, NULL );
@@ -142,7 +146,8 @@ client_init(
 
     event = event_new( base, s, EV_WRITE, client_write_cb, c );
     if ( !event ) {
-        Debug( LDAP_DEBUG_ANY, "Write event could not be allocated\n" );
+        Debug( LDAP_DEBUG_ANY, "client_init: "
+                "Write event could not be allocated\n" );
         goto fail;
     }
     /* We only register the write event when we have data pending */
index 7f081486d90cb8bc2a0ae76525a1fa492b83ccc5..4b881ad5455dc0f77723a4fe94b62e8b9abffd19 100644 (file)
@@ -168,6 +168,10 @@ operation_init( Connection *c, BerElement *ber )
         ber_skip_element( ber, &op->o_ctrls );
     }
 
+    Debug( LDAP_DEBUG_TRACE, "operation_init: "
+            "set up a new operation, %s with msgid=%d for client %lu\n",
+            slap_msgtype2str( op->o_tag ), op->o_client_msgid, c->c_connid );
+
     return op;
 
 fail:
index 2a33beb90f1a0b64c948d5267f8ccc03748a3539..7d7de4f0806a386c638b895160164c9afb8bf685 100644 (file)
@@ -43,7 +43,8 @@ upstream_read_cb( evutil_socket_t s, short what, void *arg )
 
     ber = c->c_currentber;
     if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
-        Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n" );
+        Debug( LDAP_DEBUG_ANY, "upstream_read_cb: "
+                "ber_alloc failed\n" );
         ldap_pvt_thread_mutex_unlock( &c->c_mutex );
         return;
     }
@@ -54,8 +55,9 @@ upstream_read_cb( evutil_socket_t s, short what, void *arg )
 
         if ( err != EWOULDBLOCK && err != EAGAIN ) {
             char ebuf[128];
-            Debug( LDAP_DEBUG_ANY, "ber_get_next on fd %d failed errno=%d (%s)\n", c->c_fd,
-                    err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
+            Debug( LDAP_DEBUG_ANY, "upstream_read_cb: "
+                    "ber_get_next on fd %d failed errno=%d (%s)\n",
+                    c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
 
             c->c_currentber = NULL;
             goto fail;
@@ -146,13 +148,15 @@ upstream_finish( Connection *c )
     evutil_socket_t s = c->c_fd;
 
     Debug( LDAP_DEBUG_CONNS, "upstream_finish: "
-            "connection %lu is ready for use\n", c->c_connid );
+            "connection %lu is ready for use\n",
+            c->c_connid );
 
     base = slap_get_base( s );
 
     event = event_new( base, s, EV_READ|EV_PERSIST, upstream_read_cb, c );
     if ( !event ) {
-        Debug( LDAP_DEBUG_ANY, "Read event could not be allocated\n" );
+        Debug( LDAP_DEBUG_ANY, "upstream_finish: "
+                "Read event could not be allocated\n" );
         goto fail;
     }
     event_add( event, NULL );
@@ -196,7 +200,8 @@ upstream_bind_cb( evutil_socket_t s, short what, void *arg )
 
     ber = c->c_currentber;
     if ( ber == NULL && (ber = ber_alloc()) == NULL ) {
-        Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n" );
+        Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
+                "ber_alloc failed\n" );
         ldap_pvt_thread_mutex_unlock( &c->c_mutex );
         return;
     }
@@ -207,8 +212,9 @@ upstream_bind_cb( evutil_socket_t s, short what, void *arg )
 
         if ( err != EWOULDBLOCK && err != EAGAIN ) {
             char ebuf[128];
-            Debug( LDAP_DEBUG_ANY, "ber_get_next on fd %d failed errno=%d (%s)\n", c->c_fd,
-                    err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
+            Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
+                    "ber_get_next on fd %d failed errno=%d (%s)\n",
+                    c->c_fd, err, sock_errstr( err, ebuf, sizeof(ebuf) ) );
 
             c->c_currentber = NULL;
             goto fail;
@@ -220,22 +226,22 @@ upstream_bind_cb( evutil_socket_t s, short what, void *arg )
     c->c_currentber = NULL;
 
     if ( ber_scanf( ber, "it", &msgid, &tag ) == LBER_ERROR ) {
-        Debug( LDAP_DEBUG_ANY, "upstream_bind_cb:"
-                " protocol violation from server\n" );
+        Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
+                "protocol violation from server\n" );
         goto fail;
     }
 
     if ( msgid != ( c->c_next_msgid - 1 ) || tag != LDAP_RES_BIND ) {
-        Debug( LDAP_DEBUG_ANY, "upstream_bind_cb:"
-                " unexpected %s from server, msgid=%d\n",
+        Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
+                "unexpected %s from server, msgid=%d\n",
                 slap_msgtype2str( tag ), msgid );
         goto fail;
     }
 
     if ( ber_scanf( ber, "{eAA" /* "}" */, &result, &matcheddn, &message ) ==
                  LBER_ERROR ) {
-        Debug( LDAP_DEBUG_ANY, "upstream_bind_cb:"
-                " response does not conform with a bind response\n" );
+        Debug( LDAP_DEBUG_ANY, "upstream_bind_cb: "
+                "response does not conform with a bind response\n" );
         goto fail;
     }
 
@@ -315,7 +321,8 @@ upstream_bind( void *ctx, void *arg )
 
     event = event_new( base, s, EV_READ|EV_PERSIST, upstream_bind_cb, c );
     if ( !event ) {
-        Debug( LDAP_DEBUG_ANY, "Read event could not be allocated\n" );
+        Debug( LDAP_DEBUG_ANY, "upstream_bind: "
+                "Read event could not be allocated\n" );
         upstream_destroy( c );
         return NULL;
     }
@@ -373,7 +380,8 @@ upstream_init( ber_socket_t s, Backend *b )
 
     event = event_new( base, s, EV_WRITE, upstream_write_cb, c );
     if ( !event ) {
-        Debug( LDAP_DEBUG_ANY, "Write event could not be allocated\n" );
+        Debug( LDAP_DEBUG_ANY, "upstream_init: "
+                "Write event could not be allocated\n" );
         goto fail;
     }
     /* We only register the write event when we have data pending */