Commit 9202e761 authored by Matija Obreza's avatar Matija Obreza
Browse files

Reduced logging noise

parent ebe9ed81
......@@ -66,7 +66,7 @@ public class ElasticJPAListener {
*/
@AfterReturning(value = "execution(* org.springframework.data.jpa.repository.JpaRepository.save(..))", returning = "result")
public void afterPersist(final JoinPoint joinPoint, final Object result) {
LOG.warn("JPA afterPersist {} {}", joinPoint.toLongString(), joinPoint.getTarget());
LOG.debug("JPA afterPersist {} {}", joinPoint.toLongString(), joinPoint.getTarget());
try {
scheduleReindexing(result);
......@@ -85,7 +85,7 @@ public class ElasticJPAListener {
final Object[] args = joinPoint.getArgs();
try {
final Object removed = args[0];
LOG.warn("JPA afterRemove: {} {}", joinPoint.toLongString(), joinPoint.getTarget());
LOG.debug("JPA afterRemove: {} {}", joinPoint.toLongString(), joinPoint.getTarget());
scheduleReindexing(removed);
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
......
......@@ -15,10 +15,10 @@
*/
package org.genesys.catalog.server.controller.api.v0;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys.catalog.exceptions.InvalidApiUsageException;
import org.genesys.catalog.exceptions.NotFoundElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.http.HttpStatus;
import org.springframework.http.converter.HttpMessageNotReadableException;
......@@ -39,7 +39,7 @@ import org.springframework.web.context.request.WebRequest;
public class ApiExceptionHandler {
/** The log. */
protected final Log LOG = LogFactory.getLog(getClass());
protected final Logger LOG = LoggerFactory.getLogger(getClass());
// @ResponseStatus(code = HttpStatus.NOT_FOUND)
// @ExceptionHandler(NoSuchAccessionException.class)
......@@ -61,7 +61,7 @@ public class ApiExceptionHandler {
@ExceptionHandler({ AuthenticationCredentialsNotFoundException.class })
@ResponseBody
public ApiError<Exception> handleMissingCredentials(final Exception e, final WebRequest request) {
LOG.warn("Authentication is required.", e);
LOG.warn("Authentication is required: {}", request.getDescription(true));
return new ApiError<>(e);
}
......@@ -76,7 +76,7 @@ public class ApiExceptionHandler {
@ExceptionHandler({ AccessDeniedException.class })
@ResponseBody
public ApiError<Exception> handleAccessDenied(final Exception e, final WebRequest request) {
LOG.warn("Authentication is required.", e);
LOG.warn("Access denied: {}", request.getDescription(true));
return new ApiError<>(e);
}
......@@ -91,7 +91,7 @@ public class ApiExceptionHandler {
@ExceptionHandler(HttpMessageNotReadableException.class)
@ResponseBody
public ApiError<Exception> handleConverterError(final Exception e, final WebRequest request) {
LOG.warn("Invalid payload provided.", e);
LOG.warn("Invalid payload provided: {}", request.getDescription(true));
return new ApiError<>(e);
}
......@@ -106,7 +106,7 @@ public class ApiExceptionHandler {
@ExceptionHandler({ InvalidApiUsageException.class, ConcurrencyFailureException.class })
@ResponseBody
public ApiError<Exception> handleInvalidApiUsage(final Exception e, final WebRequest request) {
LOG.warn("Invalid payload provided.", e);
LOG.warn("API error: {} in {}", e.getMessage(), request.getDescription(true));
return new ApiError<>(e);
}
......@@ -121,7 +121,7 @@ public class ApiExceptionHandler {
@ExceptionHandler(NotFoundElement.class)
@ResponseBody
public ApiError<Exception> handleNotFound(final Exception e, final WebRequest request) {
LOG.warn("Element not found", e);
LOG.warn("Element not found: {}", request.getDescription(true));
return new ApiError<>(e);
}
......@@ -136,7 +136,7 @@ public class ApiExceptionHandler {
@ExceptionHandler(Throwable.class)
@ResponseBody
public ApiError<Exception> handleServerError(final Exception e, final WebRequest request) {
LOG.error("Wow! Such! Exception!", e);
LOG.error("Wow! Such! Exception! {}", request.getDescription(true), e);
return new ApiError<>(e);
}
}
......@@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.genesys.blocks.model.JsonViews;
import org.genesys.blocks.oauth.model.OAuthClient;
import org.genesys.blocks.oauth.service.OAuthClientDetailsService;
import org.genesys.blocks.security.model.AclObjectIdentity;
......@@ -43,6 +44,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonView;
/**
* The Class PermissionController.
*
......@@ -75,6 +78,7 @@ public class PermissionController {
*/
@Transactional
@PostMapping(value = "/permissions/{clazz}/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(JsonViews.Minimal.class)
public AclObjectIdentity addPermission(@PathVariable(value = "clazz") final String className, @PathVariable("id") final long id,
@RequestBody final SidPermissions sidPermissions) {
final AclObjectIdentity objectIdentity = aclService.ensureObjectIdentity(id, className);
......@@ -94,6 +98,7 @@ public class PermissionController {
*/
@Transactional(readOnly = true)
@GetMapping(value = "/permissions/{clazz}/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(JsonViews.Minimal.class)
public AclObjectIdentity permissions(@PathVariable(value = "clazz") final String className, @PathVariable("id") final long id) {
final AclObjectIdentity objectIdentity = aclService.getObjectIdentity(id, className);
return lazyLoadForJson(objectIdentity);
......@@ -121,6 +126,7 @@ public class PermissionController {
* @return the acl object identity
*/
@GetMapping(value = "/permissions/{aclObjectIdentityId}", produces = MediaType.APPLICATION_JSON_VALUE)
@JsonView(JsonViews.Minimal.class)
public AclObjectIdentity permissions(@PathVariable(value = "aclObjectIdentityId") final long id) {
final AclObjectIdentity objectIdentity = aclService.getObjectIdentity(id);
return lazyLoadForJson(objectIdentity);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment