Skip to content

Commit 09de4ad

Browse files
authored
Merge pull request #4130 from zlamalp/log
refactor(core): updated logging of group synchronization
2 parents 210cc42 + 09af8e2 commit 09de4ad

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/GroupsManagerBlImpl.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ public List<String> synchronizeGroup(PerunSession sess, Group group) throws Attr
19611961

19621962
long startTime = System.nanoTime();
19631963
getPerunBl().getAuditer().log(sess,new GroupSyncStarted(group));
1964-
log.debug("Group synchronization for {} has been started.", group);
1964+
log.info("Group synchronization for {} has been started.", group);
19651965

19661966
//Initialization of group extSource
19671967
source = getGroupExtSourceForSynchronization(sess, group);
@@ -1987,25 +1987,28 @@ public List<String> synchronizeGroup(PerunSession sess, Group group) throws Attr
19871987
List<RichMember> actualGroupMembers = getPerunBl().getGroupsManagerBl().getGroupDirectRichMembers(sess, group);
19881988

19891989
if(lightweightSynchronization) {
1990+
log.debug("Group synchronization {}: categorize members for lightweight sync", group);
19901991
categorizeMembersForLightweightSynchronization(sess, group, source, membersSource, actualGroupMembers, candidatesToAdd, membersToRemove, skippedMembers);
19911992
} else {
19921993
//Get subjects from extSource
19931994
List<Map<String, String>> subjects = getSubjectsFromExtSource(sess, source, group);
19941995
//Convert subjects to candidates
19951996
List<Candidate> candidates = convertSubjectsToCandidates(sess, subjects, membersSource, source, actualGroupMembers, skippedMembers);
1996-
1997+
log.debug("Group synchronization {}: categorize members for standard sync", group);
19971998
categorizeMembersForSynchronization(sess, actualGroupMembers, candidates, candidatesToAdd, membersToUpdate, membersToRemove);
19981999
}
19992000

20002001
// Remove members from group who are not present in synchronized ExtSource
20012002
boolean isAuthoritative = isAuthoritative(sess, group);
20022003
Collections.sort(membersToRemove);
2004+
log.debug("Group synchronization {}: removing {} members", group, membersToRemove.size());
20032005
for (RichMember memberToRemove : membersToRemove) {
20042006
removeFormerMemberWhileSynchronization(sess, group, memberToRemove, isAuthoritative);
20052007
}
20062008

20072009
List<AttributeDefinition> attrDefs = new ArrayList<>();
20082010
//Update members already presented in group
2011+
log.debug("Group synchronization {}: updating {} members", group, membersToUpdate.size());
20092012
for (Candidate candidate : membersToUpdate.keySet()) {
20102013
RichMember memberToUpdate = membersToUpdate.get(candidate);
20112014
//Load attrDefinitions just once for first candidate
@@ -2017,6 +2020,7 @@ public List<String> synchronizeGroup(PerunSession sess, Group group) throws Attr
20172020

20182021
//Add not presented candidates to group
20192022
Collections.sort(candidatesToAdd);
2023+
log.debug("Group synchronization {}: adding {} members", group, candidatesToAdd.size());
20202024
for (Candidate candidateToAdd : candidatesToAdd) {
20212025
addMissingMemberWhileSynchronization(sess, group, candidateToAdd, overwriteUserAttributesList, mergeMemberAttributesList, skippedMembers);
20222026
}
@@ -3759,7 +3763,7 @@ private List<Candidate> convertSubjectsToCandidates(PerunSession sess, List<Map<
37593763
* @throws WrongAttributeAssignmentException if some attribute is updated in bad way (bad assignment)
37603764
*/
37613765
public void updateExistingMemberWhileSynchronization(PerunSession sess, Group group, Candidate candidate, RichMember memberToUpdate, List<String> overwriteUserAttributesList, List<String> mergeMemberAttributesList, List<AttributeDefinition> attrDefs) {
3762-
//If member does not exists in this moment (somebody removed him before updating process), skip him and log it
3766+
//If member does not exist at this moment (somebody removed him before updating process), skip him and log it
37633767
try {
37643768
getPerunBl().getMembersManagerBl().checkMemberExists(sess, memberToUpdate);
37653769
} catch (MemberNotExistsException ex) {

perun-core/src/main/java/cz/metacentrum/perun/core/impl/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public static List<RichUserExtSource> extractAdditionalUserExtSources(PerunSessi
217217

218218
// Entry contains extSourceName|extSourceType|extLogin;uesAttribute=value1,value2[|LoA]
219219
String[] userExtSourceRaw = subjectFromExtSource.get(attrName).split("\\|");
220-
log.debug("Processing additionalUserExtSource {}", subjectFromExtSource.get(attrName));
220+
log.trace("Processing additionalUserExtSource {}", subjectFromExtSource.get(attrName));
221221

222222
// Check if the array has at least 3 parts, this is protection against outOfBoundException
223223
if(userExtSourceRaw.length < 3) {

0 commit comments

Comments
 (0)