Skip to content

Commit e86029a

Browse files
authored
Lower log levels (#39)
Some logs indicated problems where there are none, so we lowered some logs from 'warn' to 'info' or 'debug' and from 'error' to 'warn'.
1 parent d97b88c commit e86029a

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- type: added
2+
description: Lower log levels ([#39](https://github.com/scm-manager/scm-ldap-plugin/pull/39))

src/main/java/sonia/scm/auth/ldap/LdapGroupResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Set<String> resolve(String principal) {
8080
try {
8181
return sanitizeGroupNames(resolveGroups(config, principal), config);
8282
} catch (LdapException ex) {
83-
LOG.error("failed to resolve groups for principal: {}", principal, ex);
83+
LOG.warn("failed to resolve groups for principal: {}", principal, ex);
8484
}
8585
} else {
8686
LOG.debug("ldap is disabled, returning empty set of groups");

src/main/java/sonia/scm/auth/ldap/LdapUtil.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public static void close(Context context) {
110110
try {
111111
context.close();
112112
} catch (NamingException ex) {
113-
logger.error("could not close context", ex);
113+
logger.warn("could not close context", ex);
114114
}
115115
}
116116
}
@@ -125,7 +125,7 @@ public static void close(StartTlsResponse tls) {
125125
try {
126126
tls.close();
127127
} catch (IOException ex) {
128-
logger.error("could not close tls response", ex);
128+
logger.warn("could not close tls response", ex);
129129
}
130130
}
131131
}
@@ -140,7 +140,7 @@ public static void close(NamingEnumeration<?> enm) {
140140
try {
141141
enm.close();
142142
} catch (NamingException ex) {
143-
logger.error("could not close enumeration", ex);
143+
logger.warn("could not close enumeration", ex);
144144
}
145145
}
146146
}
@@ -168,7 +168,7 @@ public static String getAttribute(Attributes attributes, String name) {
168168
}
169169
}
170170
} catch (NamingException ex) {
171-
logger.warn("could not fetch attribute ".concat(name), ex);
171+
logger.warn("could not fetch attribute '{}'", name, ex);
172172
}
173173

174174
return value;
@@ -227,10 +227,10 @@ public static int getSearchScope(String scopeString) {
227227
} else if (SCOPE_OBJECT.equalsIgnoreCase(scopeString)) {
228228
scope = SearchControls.OBJECT_SCOPE;
229229
} else if (logger.isWarnEnabled()) {
230-
logger.warn("unknown scope {}, using subtree scope", scopeString);
230+
logger.info("unknown scope {}, using subtree scope", scopeString);
231231
}
232232
} else if (logger.isWarnEnabled()) {
233-
logger.warn("no search scope defined, using subtree scope");
233+
logger.info("no search scope defined, using subtree scope");
234234
}
235235

236236
return scope;

src/main/java/sonia/scm/auth/ldap/UserSearcher.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Optional<SearchResult> search(String username, String... attributes) {
5757
if (searchResultEnm.hasMore()) {
5858
return Optional.of(searchResultEnm.next());
5959
} else {
60-
logger.warn("no user with username {} found", username);
60+
logger.debug("no user with username {} found", username);
6161
return Optional.empty();
6262
}
6363
} catch (NamingException ex) {

0 commit comments

Comments
 (0)