diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java b/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java index f2236072..d2e6ad43 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/endpoints/ScriptDeleteServlet.java @@ -32,6 +32,8 @@ import org.apache.sling.models.factory.ModelFactory; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Component( service = Servlet.class, @@ -44,6 +46,8 @@ ) public class ScriptDeleteServlet extends SlingAllMethodsServlet { + private static final Logger LOGGER = LoggerFactory.getLogger(ScriptDeleteServlet.class); + @Reference private ModelFactory modelFactory; @@ -55,11 +59,13 @@ protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse for (String path : form.getPaths()) { if (session.nodeExists(path)) { session.removeItem(path); + LOGGER.info("Item {} successfully deleted", path); } } session.save(); return ResponseEntity.ok("Item(s) successfully deleted"); } catch (Exception e) { + LOGGER.error("Error while deleting item(s)", e); return ResponseEntity.badRequest(StringUtils.defaultString(e.getMessage(), "Errors while deleting item(s)")); } });