mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 12:45:48 +00:00
Add logging to OwnerController when searching owners by last name
Signed-off-by: Anmol <anmolgrewal.p@gmail.com>
This commit is contained in:
parent
3a931080d4
commit
f7b4899846
1 changed files with 8 additions and 0 deletions
|
@ -35,6 +35,9 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
@ -47,6 +50,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|||
class OwnerController {
|
||||
|
||||
private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
|
||||
private static final Logger logger = LoggerFactory.getLogger(OwnerController.class);
|
||||
|
||||
|
||||
private final OwnerRepository owners;
|
||||
|
||||
|
@ -92,6 +97,9 @@ class OwnerController {
|
|||
@GetMapping("/owners")
|
||||
public String processFindForm(@RequestParam(defaultValue = "1") int page, Owner owner, BindingResult result,
|
||||
Model model) {
|
||||
|
||||
logger.info("Searching owners with last name: {}", owner.getLastName());
|
||||
|
||||
// allow parameterless GET request for /owners to return all records
|
||||
if (owner.getLastName() == null) {
|
||||
owner.setLastName(""); // empty string signifies broadest possible search
|
||||
|
|
Loading…
Reference in a new issue