@@ -295,6 +295,10 @@ private <T> LdapSearchResult<T> lookup(String dn, String filter, String[] attrib
295295 return lookup (dn , filter , attributes , mapper , 0 );
296296 }
297297
298+ private String getSearchDescription (String dn , String filter , String [] attributes ) {
299+ return "DN: " + dn + " , filter: " + filter + " , attributes: " + String .join ("," , attributes );
300+ }
301+
298302 /**
299303 * Lookups the LDAP server for content.
300304 *
@@ -354,7 +358,8 @@ private <T> LdapSearchResult<T> lookup(String dn, String filter, String[] attrib
354358 return new LdapSearchResult <>(sr .getNameInNamespace (), processResult (sr , mapper ));
355359 }
356360 } catch (NameNotFoundException ex ) {
357- LOGGER .log (Level .WARNING , String .format ("The LDAP name was not found on server %s" , server ), ex );
361+ LOGGER .log (Level .WARNING , String .format ("The LDAP name for search '%s' was not found on server %s" ,
362+ getSearchDescription (dn , filter , attributes ), server ), ex );
358363 throw new LdapException ("The LDAP name was not found." , ex );
359364 } catch (SizeLimitExceededException ex ) {
360365 LOGGER .log (Level .SEVERE , String .format ("The maximum size of the LDAP result has exceeded "
@@ -375,8 +380,8 @@ private <T> LdapSearchResult<T> lookup(String dn, String filter, String[] attrib
375380 actualServer = getNextServer ();
376381 return lookup (dn , filter , attributes , mapper , fail + 1 );
377382 } catch (NamingException ex ) {
378- LOGGER .log (Level .SEVERE , String .format ("An arbitrary LDAP error occurred on server %s" ,
379- server ), ex );
383+ LOGGER .log (Level .SEVERE , String .format ("An arbitrary LDAP error occurred on server %s " +
384+ "when searching for '%s'" , getSearchDescription ( dn , filter , attributes ), server ), ex );
380385 closeActualServer ();
381386 actualServer = getNextServer ();
382387 return lookup (dn , filter , attributes , mapper , fail + 1 );
0 commit comments