Code Room
Code reviewMedium
Question
Review this Java login handler's logging.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
Response login(LoginRequest req) { log.info("Login attempt: {}", req); // req.toString() includes all fields User u = userService.authenticate(req.getEmail(), req.getPassword()); if (u == null) { log.warn("Failed login for {} with password {}", req.getEmail(), req.getPassword()); return Response.unauthorized(); } log.info("Issued token {} for {}", u.getSessionToken(), u.getEmail()); return Response.ok(u.getSessionToken());}Run or narrate your approach, then ask the coach.