diff --git a/pom.xml b/pom.xml
index a3897d2e9..aca58f1e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -164,6 +164,16 @@
jaxb-api
2.3.0
+
+ ch.qos.logback
+ logback-classic
+ 1.3.11
+
+
+ ch.qos.logback
+ logback-core
+ 1.3.11
+
diff --git a/web/app/controllers/resources/WebhookAlmaFix.java b/web/app/controllers/resources/WebhookAlmaFix.java
index fe742b123..393822d14 100644
--- a/web/app/controllers/resources/WebhookAlmaFix.java
+++ b/web/app/controllers/resources/WebhookAlmaFix.java
@@ -5,7 +5,6 @@
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;
import play.mvc.Result;
@@ -20,6 +19,9 @@
import java.util.List;
import java.util.Objects;
+import ch.qos.logback.classic.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Webhook listener starting update/basedump process for the Alma Fix ETL. Also use
* to switch ES index alias. Reloads "webhook" configs dynamically, i.e. every
@@ -55,6 +57,7 @@ public class WebhookAlmaFix extends Controller {
+ MSG_ETL_PROCESS_IS_ALREADY_RUNNING;
private static final String MSG_CALLED_FROM_REMOTE_ADDRESS = "Called from: '%s' ";
private static final String FIX_FILENAME = "conf/alma/alma.fix";
+ private static final Logger etl = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(WebhookAlmaFix.class);
// If null, create default values from Global settings
public static String clusterHost = null;
public static String clusterName = null;
@@ -84,7 +87,7 @@ public static Result updateAlma(final String GIVEN_TOKEN) {
try {
msg = composeMessage(MSG_FILE_TOO_SMALL);
if (Files.size(Paths.get(filenameUpdate.split(";")[0])) < 512) {
- Logger.error(msg);
+ etl.error(msg);
AlmaMarcXmlFix2lobidJsonEs.sendMail("Triggering of " + ETL_OF + KIND, false,
msg);
return status(500, msg);
@@ -103,7 +106,7 @@ public static Result updateAlma(final String GIVEN_TOKEN) {
return status(423, msg);
}
msg = composeMessage(String.format(msgStartEtl, KIND));
- Logger.info(msg);
+ etl.info(msg);
AlmaMarcXmlFix2lobidJsonEs.setKindOfEtl(KIND);
AlmaMarcXmlFix2lobidJsonEs.setSwitchAliasAfterETL(false);
AlmaMarcXmlFix2lobidJsonEs.main(filenameUpdate, indexNameOfUpdate,
@@ -117,7 +120,7 @@ public static Result updateAlma(final String GIVEN_TOKEN) {
private static void reloadConfigs() {
Config config = ConfigFactory.parseFile(new File(RESOURCES_CONF)).resolve();
- Logger.info("reload configs:" + RESOURCES_CONF);
+ etl.info("reload configs:" + RESOURCES_CONF);
filenameUpdate = config.getString("webhook.alma.update.filename");
filenameBasedump = config.getString("webhook.alma.basedump.filename");
indexNameOfBasedump = config.getString("webhook.alma.basedump.indexname");
@@ -153,7 +156,7 @@ public static Result basedumpAlma(final String GIVEN_TOKEN) {
try {
if (Files.size(Paths.get(filenameBasedump)) < 512) {
msg = composeMessage(MSG_FILE_TOO_SMALL);
- Logger.error(msg);
+ etl.error(msg);
AlmaMarcXmlFix2lobidJsonEs.sendMail("Triggering of " + ETL_OF + KIND, false,
msg);
return status(500, msg);
@@ -170,7 +173,7 @@ public static Result basedumpAlma(final String GIVEN_TOKEN) {
return status(423, msg);
}
msg = composeMessage(String.format(msgStartEtl, KIND));
- Logger.info(msg);
+ etl.info(msg);
AlmaMarcXmlFix2lobidJsonEs.setKindOfEtl(KIND);
if (basedumpSwitchAutomatically.equals("true")) {
AlmaMarcXmlFix2lobidJsonEs.setSwitchAliasAfterETL(true);
@@ -198,9 +201,9 @@ public static Result switchEsAlias(final String GIVEN_TOKEN) {
reloadConfigs();
String subject = "switch aliases '" + alias1 + "' with '" + alias2 + "'";
String msg = composeMessage(subject);
- Logger.info(msg);
+ etl.info(msg);
if (!GIVEN_TOKEN.equals(token)) {
- Logger.info("Wrong token: " + GIVEN_TOKEN);
+ etl.info("Wrong token: " + GIVEN_TOKEN);
return wrongToken(subject, GIVEN_TOKEN);
}
boolean success;
@@ -222,7 +225,7 @@ public static Result switchEsAlias(final String GIVEN_TOKEN) {
private static Result wrongToken(final String KIND,
final String GIVEN_TOKEN) {
String msg = composeMessage(String.format(msgWrongToken, GIVEN_TOKEN, KIND));
- Logger.error(msg);
+ etl.error(msg);
AlmaMarcXmlFix2lobidJsonEs.sendMail(KIND, false, msg);
return forbidden(msg);
}
diff --git a/web/conf/logback.xml b/web/conf/logback.xml
index c053ad19c..bd36b4a82 100644
--- a/web/conf/logback.xml
+++ b/web/conf/logback.xml
@@ -1,6 +1,6 @@
-
+
./logs/application.log
@@ -13,6 +13,21 @@
%date{yyyy-MM-dd HH:mm:ss ZZZZ} [%level] from %logger in %thread - %message%n%xException
+
+
+
+ ./logs/etl.log
+
+
+ etl-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
+
@@ -22,7 +37,7 @@
-
+
@@ -35,6 +50,12 @@
+
+
+
+
+
+