morningman commented on code in PR #61673:
URL: https://github.com/apache/doris/pull/61673#discussion_r2991832330


##########
fe/fe-core/src/main/java/org/apache/doris/mysql/authenticate/ldap/LdapClient.java:
##########
@@ -212,18 +248,25 @@ private String getUserDn(String userName) {
     @VisibleForTesting
     public List<String> getDn(LdapQuery query) {
         init();
+        long start = System.currentTimeMillis();
         try {
-            return clientInfo.getLdapTemplatePool().search(query,
+            List<String> result = clientInfo.getSearchTemplate().search(query,
                     new AbstractContextMapper<String>() {
                         protected String doMapFromContext(DirContextOperations 
ctx) {
                             return ctx.getNameInNamespace();
                         }
                     });
+            long elapsed = System.currentTimeMillis() - start;
+            LOG.info("[LDAP-AUTH] LdapClient.getDn: base={}, elapsed={}ms, 
results={}",
+                    query.base(), elapsed, result == null ? 0 : result.size());
+            return result;
         } catch (Exception e) {
+            long elapsed = System.currentTimeMillis() - start;
             String msg
                     = "Failed to retrieve the user's Distinguished Name (DN),"
                     + "This may be due to incorrect LDAP configuration or an 
unset/incorrect LDAP admin password.";
-            LOG.error(msg, e);
+            LOG.error("[LDAP-AUTH] LdapClient.getDn failed: base={}, 
elapsed={}ms, error={}",

Review Comment:
   ```suggestion
               LOG.warn("[LDAP-AUTH] LdapClient.getDn failed: base={}, 
elapsed={}ms, error={}",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to