diff --git a/pom.xml b/pom.xml index a3897d2e9..3c7f8136b 100644 --- a/pom.xml +++ b/pom.xml @@ -164,6 +164,21 @@ jaxb-api 2.3.0 + + ch.qos.logback + logback-classic + 1.3.11 + + + ch.qos.logback + logback-core + 1.3.11 + + + org.slf4j + slf4j-api + 2.0.7 + diff --git a/src/main/java/de/hbz/lobid/helper/Etikett.java b/src/main/java/de/hbz/lobid/helper/Etikett.java index 23d282e61..7641d4942 100644 --- a/src/main/java/de/hbz/lobid/helper/Etikett.java +++ b/src/main/java/de/hbz/lobid/helper/Etikett.java @@ -233,4 +233,4 @@ public Map getMultilangLabel() { return multilangLabel; } -} \ No newline at end of file +} diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml deleted file mode 100644 index 412b596f7..000000000 --- a/src/main/resources/log4j.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index 09de0a31e..3c60fd459 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -1,7 +1,7 @@ - + diff --git a/web/app/controllers/resources/WebhookAlmaFix.java b/web/app/controllers/resources/WebhookAlmaFix.java index fe742b123..ea828d394 100644 --- a/web/app/controllers/resources/WebhookAlmaFix.java +++ b/web/app/controllers/resources/WebhookAlmaFix.java @@ -5,6 +5,7 @@ import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.lobid.resources.run.AlmaMarcXmlFix2lobidJsonEs; + import play.Logger; import play.mvc.Controller; import play.mvc.Http; @@ -87,19 +88,22 @@ public static Result updateAlma(final String GIVEN_TOKEN) { Logger.error(msg); AlmaMarcXmlFix2lobidJsonEs.sendMail("Triggering of " + ETL_OF + KIND, false, msg); + Logger.warn(msg); return status(500, msg); } } catch (IOException e) { - msg = composeMessage(e.getMessage()); + msg = composeMessage("Problems with data file\n" + e.getMessage()); AlmaMarcXmlFix2lobidJsonEs.sendMail("Triggering of " + ETL_OF + KIND, false, msg); - return status(500, "Problems with data file\n" + msg); + Logger.warn(msg); + return status(500, msg); } if (AlmaMarcXmlFix2lobidJsonEs.threadAlreadyStarted) { msg = composeMessage(String.format(MSG_UPDATE_ALREADY_RUNNING, indexNameOfUpdate)); AlmaMarcXmlFix2lobidJsonEs.sendMail(ETL_OF + KIND, false, msg); + Logger.warn(msg); return status(423, msg); } msg = composeMessage(String.format(msgStartEtl, KIND)); @@ -156,17 +160,21 @@ public static Result basedumpAlma(final String GIVEN_TOKEN) { Logger.error(msg); AlmaMarcXmlFix2lobidJsonEs.sendMail("Triggering of " + ETL_OF + KIND, false, msg); + Logger.warn(msg); return status(500, msg); } } catch (IOException e) { - return status(500, "Problems with data file\n" + e); + msg = composeMessage("IO Problems with data file\n" + e); + Logger.warn(msg); + return status(500, msg); } createIndexNameOfBasedump = indexNameOfBasedump + "-" + LocalDateTime.now() .format(DateTimeFormatter.ofPattern("yyyyMMdd-kkmm")); if (AlmaMarcXmlFix2lobidJsonEs.threadAlreadyStarted) { msg = composeMessage(String.format(MSG_CREATE_INDEX_ALREADY_RUNNING, createIndexNameOfBasedump)); AlmaMarcXmlFix2lobidJsonEs.sendMail(ETL_OF + KIND, false, msg); + Logger.warn(msg); return status(423, msg); } msg = composeMessage(String.format(msgStartEtl, KIND)); @@ -200,22 +208,24 @@ public static Result switchEsAlias(final String GIVEN_TOKEN) { String msg = composeMessage(subject); Logger.info(msg); if (!GIVEN_TOKEN.equals(token)) { - Logger.info("Wrong token: " + GIVEN_TOKEN); return wrongToken(subject, GIVEN_TOKEN); } boolean success; if (AlmaMarcXmlFix2lobidJsonEs.threadAlreadyStarted) { msg = composeMessage(String.format(MSG_CREATE_INDEX_ALREADY_RUNNING, createIndexNameOfBasedump)); AlmaMarcXmlFix2lobidJsonEs.sendMail("Failed: " + subject, false, msg); + Logger.warn(msg); return status(423, msg); } AlmaMarcXmlFix2lobidJsonEs.setSwitchVariables(alias1, alias2, clusterHost, basedumpSwitchMindocs, basedumpSwitchMinsize); success = AlmaMarcXmlFix2lobidJsonEs.switchAlias(); if (success) { msg = composeMessage(AlmaMarcXmlFix2lobidJsonEs.MSG_SUCCESS + subject); + Logger.info(msg); return ok(msg); } msg = composeMessage(AlmaMarcXmlFix2lobidJsonEs.MSG_FAIL + subject); + Logger.warn("Wrong token: " + GIVEN_TOKEN); return internalServerError(msg); } @@ -224,6 +234,7 @@ private static Result wrongToken(final String KIND, String msg = composeMessage(String.format(msgWrongToken, GIVEN_TOKEN, KIND)); Logger.error(msg); AlmaMarcXmlFix2lobidJsonEs.sendMail(KIND, false, msg); + Logger.warn(msg); return forbidden(msg); } diff --git a/web/conf/logback.xml b/web/conf/logback.xml deleted file mode 100644 index 9a4127b71..000000000 --- a/web/conf/logback.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - ./logs/application.log - - - application-log-%d{yyyy-MM-dd}.%i.gz - - 21 - - 100MB - - - %date{yyyy-MM-dd HH:mm:ss ZZZZ} [%level] from %logger in %thread - %message%n%xException - - - - - - %coloredLevel %logger{15} - %message%n%xException{10} - - - - - - - - - - - - - - - - - - - - - - - - - -