Improved logging for rest classes

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@150486 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-06-22 15:41:26 +00:00
parent 69d45439c9
commit 10b00af70e
3 changed files with 22 additions and 10 deletions

View File

@ -16,6 +16,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException;
@ -57,7 +58,7 @@ public class ContextManager {
@QueryParam(ContextPath.PARENT_CONTEXT_ID_PARAM) @DefaultValue("") String parentUUID,
@QueryParam(ContextPath.NAME_PARAM) String name)
throws ContextCreationException, ResourceRegistryException {
logger.trace("requested to create context with name : {} ", name);
logger.info("Requested to create {} with name : {} ", Context.NAME, name);
UUID parent = null;
if(parentUUID!=null && parentUUID.compareTo("")!=0){
parent = UUID.fromString(parentUUID);
@ -77,7 +78,7 @@ public class ContextManager {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public boolean delete(@PathParam(ID_PATH_PARAM) String uuid)
throws ContextNotFoundException, ContextException {
logger.trace("requested to delete context with id {} ", uuid);
logger.info("Requested to delete {} with id {} ", Context.NAME, uuid);
return contextManager.delete(UUID.fromString(uuid));
}
@ -95,7 +96,7 @@ public class ContextManager {
public String rename(@PathParam(ID_PATH_PARAM) String uuid,
@QueryParam(ContextPath.NAME_PARAM) String name)
throws ContextNotFoundException, ContextException {
logger.trace("requested to rename context id {} with {} ", uuid, name);
logger.info("Requested to rename as {} {} with id {} ", name, Context.NAME, uuid);
return contextManager.rename(UUID.fromString(uuid), name);
}
@ -114,8 +115,8 @@ public class ContextManager {
@PathParam(ID_PATH_PARAM) String uuid,
@QueryParam(ContextPath.PARENT_CONTEXT_ID_PARAM) String newParentUUID)
throws ContextNotFoundException, ContextException {
logger.trace("requested to move context id {} with new parend id {} ",
uuid, newParentUUID);
logger.info("Requested to move {} with id {} as child of {} having id {} ",
Context.NAME, uuid, Context.NAME, newParentUUID);
return contextManager.move(UUID.fromString(newParentUUID),
UUID.fromString(uuid));
}

View File

@ -66,7 +66,8 @@ public class ERManager {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public Response createFacet(@PathParam(TYPE_PATH_PARAM) String type,
String json) throws FacetAlreadyPresentException, ResourceRegistryException {
logger.info("requested facet creation for type {} defined by {} ",
logger.info("requested facet creation for type {}", type);
logger.trace("requested facet creation for type {} defined by {} ",
type, json);
FacetManagement facetManagement = new FacetManagement();
facetManagement.setElementType(type);
@ -93,7 +94,8 @@ public class ERManager {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String updateFacet(@PathParam(ID_PATH_PARAM) String uuid, String json)
throws FacetNotFoundException, ResourceRegistryException {
logger.info("requested facet update for id {} with {}", uuid, json);
logger.info("requested facet update for id {}", uuid);
logger.trace("requested facet update for id {} with {}", uuid, json);
FacetManagement facetManagement = new FacetManagement();
facetManagement.setUUID(UUID.fromString(uuid));
facetManagement.setJSON(json);
@ -138,7 +140,8 @@ public class ERManager {
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public Response createResource(@PathParam(TYPE_PATH_PARAM) String type,
String json) throws ResourceAlreadyPresentException, ResourceRegistryException {
logger.info("requested resource creation for type {} with json {}",
logger.info("requested resource creation for type {}", type);
logger.trace("requested resource creation for type {} with json {}",
type, json);
ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(type);
@ -163,7 +166,8 @@ public class ERManager {
public String updateResource(@PathParam(ID_PATH_PARAM) String uuid,
String json) throws ResourceNotFoundException,
ResourceRegistryException {
logger.info("requested resource update for id {} with {}", uuid, json);
logger.info("requested resource update for id {}", uuid);
logger.trace("requested resource update for id {} with {}", uuid, json);
ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setUUID(UUID.fromString(uuid));
resourceManagement.setJSON(json);
@ -220,6 +224,10 @@ public class ERManager {
throws FacetNotFoundException, ResourceNotFoundException,
ResourceRegistryException {
logger.info(
"requested to attach resource {} to facet {} ({} Type {})",
resourceUUID, facetUUID, ConsistsOf.class.getSimpleName(),
type);
logger.trace(
"requested to attach resource {} to facet {} ({} Type {}) with properties {}",
resourceUUID, facetUUID, ConsistsOf.class.getSimpleName(),
type, json);
@ -250,6 +258,9 @@ public class ERManager {
public Response createConsistsOf(@PathParam(TYPE_PATH_PARAM) String type,
String json) throws ResourceAlreadyPresentException, ResourceRegistryException {
logger.info(
"Requested to create {} {} of type {}",
ConsistsOf.NAME, Relation.NAME, type);
logger.trace(
"Requested to create {} {} of type {} : {}",
ConsistsOf.NAME, Relation.NAME, type, json);
ConsistsOfManagement consistsOfManagement = new ConsistsOfManagement();

View File

@ -47,7 +47,7 @@ public class SchemaManager {
@PathParam(TYPE_PATH_PARAM) String type,
String json)
throws SchemaException, ResourceRegistryException {
logger.trace("Requested {} registration with schema {}", type, json);
logger.info("Requested {} registration with schema {}", type, json);
AccessType accessType = null;
try {