Change LDAP_DEBUG_TRACE to LDAP_DEBUG_ANY.
Add log msg if it wasn't being logged before.
                txn = NULL;
                if ( rs->sr_err != 0 ) {
                        rs->sr_text = "txn_commit failed";
-                       Debug( LDAP_DEBUG_TRACE,
+                       Debug( LDAP_DEBUG_ANY,
                                LDAP_XSTRING(mdb_add) ": %s : %s (%d)\n",
                                rs->sr_text, mdb_strerror(rs->sr_err), rs->sr_err );
                        rs->sr_err = LDAP_OTHER;
 
                        mdb_txn_abort( txn );
                        txn = NULL;
                }
-               if ( rc )
+               if ( rc ) {
+                       Debug( LDAP_DEBUG_ANY,
+                               LDAP_XSTRING(mdb_online_index) ": database %s: "
+                               "txn_commit failed: %s (%d)\n",
+                               be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
                        break;
+               }
                id++;
                getnext = 1;
        }
 
        }
 
        if( rs->sr_err != 0 ) {
-               Debug( LDAP_DEBUG_TRACE,
+               Debug( LDAP_DEBUG_ANY,
                        LDAP_XSTRING(mdb_delete) ": txn_%s failed: %s (%d)\n",
                        op->o_noop ? "abort (no-op)" : "commit",
                        mdb_strerror(rs->sr_err), rs->sr_err );
 
 
        rc = mdb_txn_commit(txn);
        if ( rc != 0 ) {
+               Debug( LDAP_DEBUG_ANY,
+                       LDAP_XSTRING(mdb_db_open) ": database %s: "
+                       "txn_commit failed: %s (%d)\n",
+                       be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
                goto fail;
        }
 
 
        }
 
        if( rs->sr_err != 0 ) {
-               Debug( LDAP_DEBUG_TRACE,
+               Debug( LDAP_DEBUG_ANY,
                        LDAP_XSTRING(mdb_modify) ": txn_%s failed: %s (%d)\n",
                        op->o_noop ? "abort (no-op)" : "commit",
                        mdb_strerror(rs->sr_err), rs->sr_err );
 
        }
 
        if( rs->sr_err != LDAP_SUCCESS ) {
-               Debug( LDAP_DEBUG_TRACE,
+               Debug( LDAP_DEBUG_ANY,
                        LDAP_XSTRING(mdb_modrdn) ": %s : %s (%d)\n",
                        rs->sr_text, mdb_strerror(rs->sr_err), rs->sr_err );
                rs->sr_err = LDAP_OTHER;
 
                cursor = NULL;
        }
        if( txn ) {
+               int rc;
                MDB_TOOL_IDL_FLUSH( be, txn );
-               if ( mdb_txn_commit( txn ))
+               if (( rc = mdb_txn_commit( txn ))) {
+                       Debug( LDAP_DEBUG_ANY,
+                               LDAP_XSTRING(mdb_tool_entry_close) ": database %s: "
+                               "txn_commit failed: %s (%d)\n",
+                               be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
                        return -1;
+               }
                txn = NULL;
        }