From ce192eb3a69df142190bb111f30ef999ce333723 Mon Sep 17 00:00:00 2001
From: Ludovic Claude <ludovic.claude54@gmail.com>
Date: Fri, 25 Jan 2019 10:58:21 +0100
Subject: [PATCH] Fix startup

---
 pom.xml                                      | 16 +++++++++++++---
 src/main/java/eu/hbp/mip/MIPApplication.java |  2 ++
 src/main/java/eu/hbp/mip/StartupTasks.java   |  3 ++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index b493eb149..e08e23a2f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <groupId>eu.hbp.mip</groupId>
@@ -15,7 +15,7 @@
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
         <version>1.3.7.RELEASE</version>
-        <relativePath />
+        <relativePath/>
     </parent>
 
     <properties>
@@ -75,7 +75,17 @@
     <dependencies>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-logging</artifactId>
+            <artifactId>spring-boot-starter-log4j2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
diff --git a/src/main/java/eu/hbp/mip/MIPApplication.java b/src/main/java/eu/hbp/mip/MIPApplication.java
index df70ba78a..489fe56d5 100644
--- a/src/main/java/eu/hbp/mip/MIPApplication.java
+++ b/src/main/java/eu/hbp/mip/MIPApplication.java
@@ -4,6 +4,7 @@
 
 package eu.hbp.mip;
 
+import ch.chuv.lren.mip.portal.Reporting;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
@@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 public class MIPApplication {
 
     public static void main(String[] args) {
+        new Reporting().init();
         SpringApplication.run(MIPApplication.class, args);
     }
 
diff --git a/src/main/java/eu/hbp/mip/StartupTasks.java b/src/main/java/eu/hbp/mip/StartupTasks.java
index b9c44c8ad..fa58eaf92 100644
--- a/src/main/java/eu/hbp/mip/StartupTasks.java
+++ b/src/main/java/eu/hbp/mip/StartupTasks.java
@@ -43,13 +43,14 @@ public class StartupTasks implements ApplicationListener<ApplicationReadyEvent>
         // Pre-fill the local variable repository with the list of datasets, interpreted here as variables
         // (a bit like a categorical variable can be split into a set of variables (a.k.a one hot encoding in Data science) )
         // Try 5 times, to be more robust in the face of cluster failures / slow startup
+        LOGGER.info("Prefill variable repository with datasets...");
         for (int i = 0; i < 5; i++) {
             try {
                 for (Dataset dataset : datasetsApi.fetchDatasets()) {
                     final String code = dataset.dataset().code();
                     Variable v = variableRepository.findOne(code);
                     if (v == null) {
-                        LOGGER.info("Store additional variable {}", v.getCode());
+                        LOGGER.info("Store additional variable {}", code);
                         v = new Variable(code);
                         variableRepository.save(v);
                     }
-- 
GitLab