Skip to content
Snippets Groups Projects

Dev/251 refactor logging

Merged Kostas FILIPPOPOLITIS requested to merge dev/251_refactor_logging into master

Created by: KFilippopolitis

Refactored all logs.

  1. Disabled spring boot framework logs.
  2. Added 2 logs at every endpoint, when entering and returning, with useful information.
  3. Unified the logs output.
  4. Reworked the output in order for it to be visually consistent.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
11
12 public static void LogUserAction(String userName, String endpoint, String actionInfo) {
13 maxEndpointLen = (maxEndpointLen < userName.length() ? userName.length() : maxEndpointLen);
14 maxInfoLen = (maxInfoLen < endpoint.length() ? endpoint.length() : maxInfoLen);
15 String endpointSpacing = String.format("%" + (maxEndpointLen - userName.length() + 2) + "s", "");
16 String infoSpacing = String.format("%" + (maxInfoLen - endpoint.length() + 2) + "s", "");
17 LOGGER.info(" User -> " + userName
18 + endpointSpacing
19 + ", Endpoint -> " + endpoint
20 + infoSpacing
21 + ", Info -> " + actionInfo);
22 }
23
24 // Used from Threads because threads can't get userName.
25 public static void LogExperimentAction(String experimentName, String actionInfo) {
26 LOGGER.info(" Experiment -> " + experimentName
  • 118 122 @ApiOperation(value = "Create an experiment", response = Experiment.class)
    119 123 @RequestMapping(value = "/runAlgorithm", method = RequestMethod.POST)
    120 124 public ResponseEntity<String> runExperiment(Authentication authentication, @RequestBody ExperimentExecutionDTO experimentExecutionDTO) {
    121 UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run algorithm", "Running the algorithm...");
    125 User user = userInfo.getUser();
    126 // Get the type and name of algorithm
    127 String algorithmType = experimentExecutionDTO.getAlgorithms().get(0).getType();
  • Kostas FILIPPOPOLITIS
  • Created by: ThanKarab

    Review: Approved

  • Merged by: ThanKarab at 2020-10-15 07:06:25 UTC

  • Please register or sign in to reply