Small changes in Logging

This commit is contained in:
Maximilian Leopold 2019-05-13 19:08:02 +02:00
parent 9608f082ae
commit c75eb3f5e2
2 changed files with 13 additions and 16 deletions

View File

@ -12,10 +12,7 @@ import io.jsonwebtoken.Claims;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@ -62,7 +59,7 @@ public class Controller {
private org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Controller.class);
@PostConstruct
public void init(){
public void init() {
fetchPublicKey();
}
@ -338,7 +335,7 @@ public class Controller {
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
@RequestMapping(value = "/api/editCache", method = RequestMethod.PUT, produces = "application/json")
@ResponseBody
public ResponseEntity editCache(@RequestBody Cache newCache){
public ResponseEntity editCache(@RequestBody Cache newCache) {
//----------------------
//Get Cache
@ -828,7 +825,7 @@ public class Controller {
List<TeamInvite> teamInvitesList = teamInviteRepository.findByUser(user);
for (TeamInvite tmp : teamInvitesList){
for (TeamInvite tmp : teamInvitesList) {
tmp.setUser(null);
}
@ -1112,7 +1109,7 @@ public class Controller {
})
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
@RequestMapping(value = "/api/getCurrentStationMap", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity getCurrentStationMap(@RequestParam String token, @RequestParam String cacheID){
public ResponseEntity getCurrentStationMap(@RequestParam String token, @RequestParam String cacheID) {
logger.warn("API CALL: /api/getCurrentStationMap");
@ -1134,7 +1131,7 @@ public class Controller {
User user = (User) getUser.getBody();
logger.debug("User verificated: " + user.getEmail());
logger.debug("/api/getCurrentStationMap " + "User verificated: " + user.getEmail());
//----------------------
//Get Cache
@ -1146,29 +1143,29 @@ public class Controller {
Cache cache = (Cache) getCache.getBody();
logger.debug("Cache: " + cache.getName());
logger.debug("/api/getCurrentStationMap " + "Cache: " + cache.getName());
//----------------------
ResponseEntity responseBearbeitet = FinderUtil.findBearbeitetByUserAndCache(user, cache);
if (responseBearbeitet.getStatusCodeValue() != 200){
if (responseBearbeitet.getStatusCodeValue() != 200) {
return responseBearbeitet;
}
Bearbeitet bearbeitet = (Bearbeitet) responseBearbeitet.getBody();
logger.debug("Got Bearbeitet:\n User: " + bearbeitet.getUser().getEmail() + "\nCache: " + bearbeitet.getCache().getName());
logger.debug("/api/getCurrentStationMap " + "Got Bearbeitet: User: " + bearbeitet.getUser().getEmail() + " Cache: " + bearbeitet.getCache().getName());
Station nextStation = bearbeitet.getAktuelleStation();
logger.debug("Got Station from bearbeitet: " + nextStation.getDescription());
logger.debug("/api/getCurrentStationMap " + "Got Station from bearbeitet: " + nextStation.getDescription());
int index = cache.getStationen().indexOf(nextStation);
logger.debug("Index of Station " + nextStation.getDescription() + " in Cache " + cache.getName() + " : " + index);
logger.debug("/api/getCurrentStationMap " + "Index of Station " + nextStation.getDescription() + " in Cache " + cache.getName() + " : " + index);
Station lastStation = cache.getStationen().get(index - 1);
logger.debug("Station before: " + lastStation.getDescription());
logger.debug("/api/getCurrentStationMap " + "Station before: " + lastStation.getDescription());
POI poi = new POI(cache.getName() + "_Station" + (index - 1.0), (float) lastStation.getLattitude(), (float) lastStation.getLongitude(), 201);
logger.debug("Created POI: " + poi.toString());
logger.debug("/api/getCurrentStationMap " + "Created POI: " + poi.toString());
return ResponseEntity.status(200).body(new Gson().toJson(poi));
}

View File

@ -5,7 +5,7 @@ spring.jmx.default-domain=buga19geocaching
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.jooq.sql-dialect=org.hibernate.dialect.MariaDBDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
# spring.jpa.show-sql=true
debug=true