I have a simple app written in Spring and for whatever reason when I perform a certain request, the server responds with 400 error. I checked my logs to troubleshoot it, but to my surprise there was no information regarding the errored request whatsoever. My Tomcat logs are all set to FINE, which I assume must include error logs. I've spent some time googling about the problem, but all the recommendations I've found are limited to setting the log level to the highest, which didn't work for me. Let me know if I can add anything...
#No error logging in Spring
10 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @topaz oar! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Can you show your endpoint?
Sure, give me a second.
ContractController.java
...
@GetMapping("/add")
public String addContractPage(Model model, Contract contract){
model.addAttribute("contract", new Contract());
model.addAttribute("actors", actors.getAllActors());
return "contracts/addContract";
}
@PostMapping("/add")
public String addContract(@ModelAttribute("contract") Contract contract){
contracts.saveContract(contract);
return "redirect:/contracts";
}
...
ContractDAO.java
...
public void saveContract(Contract contract) {
contract.setId(COUNT_CONTRACT++);
contracts.add(contract);
}
...
addContract.html
...
<form th:method="POST" th:action="@{/contracts/add}" th:object="${contract}">
<label for="name">Name</label>
<input type="text" th:field="*{name}" id="name">
<br/>
<label for="baseSalary">BaseSalary</label>
<input type="number" th:field="*{baseSalary}" id="baseSalary">
<br/>
<label for="actor">Actor</label>
<select id="actor" th:field="*{actor}" >
<option th:each="actor : ${actors}" th:text="${actor.name}" th:value="${actor.id}"> <!-- I have a Converter<Integer, Actor> registered which finds an actor by ID -->
</option>
</select>
<br/>
<input type="submit" value="save">
</form>
...
I hope this is enough information.
and submitting the form sends the request?
Yes
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.