Skip to content

Commit 19bb9a3

Browse files
committed
improve logging when calling cron jobs from system tab
1 parent da49619 commit 19bb9a3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

server/src/main/java/invite/api/SystemController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ public SystemController(ResourceCleaner resourceCleaner,
6565

6666
@GetMapping("/cron/cleanup")
6767
public ResponseEntity<Map<String, List<? extends Serializable>>> cronCleanup(@Parameter(hidden = true) User user) {
68-
LOG.debug("/cron/cleanup");
68+
LOG.debug(String.format("/cron/cleanup for user %s", user.getEduPersonPrincipalName()));
6969
UserPermissions.assertSuperUser(user);
7070
Map<String, List<? extends Serializable>> body = resourceCleaner.doClean();
7171
return ResponseEntity.ok(body);
7272
}
7373

7474
@GetMapping("/cron/expiry-notifications")
7575
public ResponseEntity<Map<String, List<String>>> expiryNotifications(@Parameter(hidden = true) User user) {
76-
LOG.debug("/cron/expiry-notifications");
76+
LOG.debug(String.format("/cron/expiry-notifications for user %s", user.getEduPersonPrincipalName()));
7777
UserPermissions.assertSuperUser(user);
7878
return ResponseEntity.ok(Map.of("mails", roleExpirationNotifier.doSweep()));
7979
}
8080

8181
@GetMapping("/expiry-user-roles")
8282
public ResponseEntity<List<UserRole>> expiryUserRoles(@Parameter(hidden = true) User user) {
83-
LOG.debug("/cron/notifications");
83+
LOG.debug(String.format("/expiry-user-roles for user %s", user.getEduPersonPrincipalName()));
8484
UserPermissions.assertSuperUser(user);
8585
Instant instant = Instant.now().plus(30, ChronoUnit.DAYS);
8686
List<UserRole> userRoles = userRoleRepository.findByEndDateBefore(instant);
@@ -91,8 +91,7 @@ public ResponseEntity<List<UserRole>> expiryUserRoles(@Parameter(hidden = true)
9191
@GetMapping("/unknown-roles")
9292
@Transactional(readOnly = true)
9393
public ResponseEntity<List<Role>> unknownRoles(@Parameter(hidden = true) User user) {
94-
LOG.debug("/unknown-roles");
95-
94+
LOG.debug(String.format("/unknown-roles for user %s", user.getEduPersonPrincipalName()));
9695
UserPermissions.assertSuperUser(user);
9796
List<Role> roles = manage.addManageMetaData(roleRepository.findAll());
9897
List<Role> unknownManageRoles = roles.stream().filter(role -> role.getApplicationMaps().stream().anyMatch(applicationMap -> applicationMap.containsKey("unknown"))).toList();
@@ -104,6 +103,7 @@ public ResponseEntity<Map<String, Object>> performanceSeed(@Parameter(hidden = t
104103
@RequestParam(value = "numberOfRole", required = false, defaultValue = "500") int numberOfRole,
105104
@RequestParam(value = "numberOfUsers", required = false, defaultValue = "75000") int numberOfUsers) {
106105
LOG.debug("/performance-seed");
106+
LOG.debug(String.format("/performance-seed for user %s", user.getEduPersonPrincipalName()));
107107
if (!config.isPerformanceSeedAllowed()) {
108108
throw new NotAllowedException("performance-seed not allowed");
109109
}

0 commit comments

Comments
 (0)