From b36abe285430daaa022a1976d9a6c2c9c4adcabc Mon Sep 17 00:00:00 2001 From: pierre-maraval Date: Thu, 20 Jun 2024 15:39:26 +0200 Subject: [PATCH] =?UTF-8?q?Refactor=20:=20Mise=20en=20place=20conf=20uniqu?= =?UTF-8?q?e=20log4j=20Suppression=20rotation=20des=20logs=20dans=20fichie?= =?UTF-8?q?rs=20Suppression=20affichage=20banni=C3=A8re=20spring=20dans=20?= =?UTF-8?q?les=20logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batch/pom.xml | 1 + .../main/resources/application-dev.properties | 8 +- .../resources/application-prod.properties | 6 +- .../resources/application-test.properties | 6 +- .../src/main/resources/application.properties | 9 +- batch/src/main/resources/log4j2-dev.xml | 133 ------------------ batch/src/main/resources/log4j2-prod.xml | 132 ----------------- batch/src/main/resources/log4j2-tests.xml | 133 ------------------ batch/src/main/resources/log4j2.xml | 19 +++ core/pom.xml | 2 +- .../main/resources/application-dev.properties | 5 +- .../resources/application-prod.properties | 7 +- .../resources/application-test.properties | 5 +- web/src/main/resources/application.properties | 8 +- web/src/main/resources/log4j2-dev.xml | 133 ------------------ web/src/main/resources/log4j2-prod.xml | 133 ------------------ web/src/main/resources/log4j2-tests.xml | 133 ------------------ web/src/main/resources/log4j2.xml | 20 +++ 18 files changed, 67 insertions(+), 826 deletions(-) delete mode 100644 batch/src/main/resources/log4j2-dev.xml delete mode 100644 batch/src/main/resources/log4j2-prod.xml delete mode 100644 batch/src/main/resources/log4j2-tests.xml create mode 100644 batch/src/main/resources/log4j2.xml delete mode 100644 web/src/main/resources/log4j2-dev.xml delete mode 100644 web/src/main/resources/log4j2-prod.xml delete mode 100644 web/src/main/resources/log4j2-tests.xml create mode 100644 web/src/main/resources/log4j2.xml diff --git a/batch/pom.xml b/batch/pom.xml index 54bbd4b9..c16aac98 100644 --- a/batch/pom.xml +++ b/batch/pom.xml @@ -70,6 +70,7 @@ true **/*.properties + **/*.xml diff --git a/batch/src/main/resources/application-dev.properties b/batch/src/main/resources/application-dev.properties index 91dc91d8..c6a891b4 100644 --- a/batch/src/main/resources/application-dev.properties +++ b/batch/src/main/resources/application-dev.properties @@ -6,7 +6,6 @@ spring.datasource.item.driver-class-name=org.postgresql.Driver spring.jpa.item.generate-ddl=false spring.jpa.item.show-sql=false spring.jpa.item.hibernate.ddl-auto=none -spring.jpa.item.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.sql.item.init.mode=never spring.hibernate.item.enable_lazy_load_no_trans=true @@ -17,9 +16,8 @@ spring.datasource.basexml.password= spring.datasource.basexml.driver-class-name=oracle.jdbc.OracleDriver spring.jpa.basexml.generate-ddl=false -spring.jpa.basexml.show-sql=true +spring.jpa.basexml.show-sql=false spring.jpa.basexml.hibernate.ddl-auto=none -spring.jpa.basexml.database-platform=org.hibernate.dialect.OracleDialect spring.sql.basexml.init.mode=never spring.hibernate.basexml.enable_lazy_load_no_trans=false @@ -31,4 +29,6 @@ sudoc.login= batch.min.hour=8 batch.max.hour=20 -spring.batch.jdbc.initialize-schema=always +# Configuration des logs +logging.level.root=INFO +logging.level.fr.abes.item=INFO diff --git a/batch/src/main/resources/application-prod.properties b/batch/src/main/resources/application-prod.properties index 45733513..a7fe0523 100644 --- a/batch/src/main/resources/application-prod.properties +++ b/batch/src/main/resources/application-prod.properties @@ -7,7 +7,6 @@ spring.datasource.item.driver-class-name=org.postgresql.Driver spring.jpa.item.generate-ddl=false spring.jpa.item.show-sql=false spring.jpa.item.hibernate.ddl-auto=none -spring.jpa.item.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.sql.item.init.mode=never spring.hibernate.item.enable_lazy_load_no_trans=true @@ -20,7 +19,6 @@ spring.datasource.basexml.driver-class-name=oracle.jdbc.OracleDriver spring.jpa.basexml.generate-ddl=false spring.jpa.basexml.show-sql=false spring.jpa.basexml.hibernate.ddl-auto=none -spring.jpa.basexml.database-platform=org.hibernate.dialect.OracleDialect spring.sql.basexml.init.mode=never spring.hibernate.basexml.enable_lazy_load_no_trans=false @@ -33,3 +31,7 @@ batch.min.hour=8 batch.max.hour=20 spring.batch.jdbc.initialize-schema=never + +# Configuration des logs +logging.level.root=WARN +logging.level.fr.abes.item=WARN diff --git a/batch/src/main/resources/application-test.properties b/batch/src/main/resources/application-test.properties index 45733513..bcc9d5e3 100644 --- a/batch/src/main/resources/application-test.properties +++ b/batch/src/main/resources/application-test.properties @@ -7,7 +7,6 @@ spring.datasource.item.driver-class-name=org.postgresql.Driver spring.jpa.item.generate-ddl=false spring.jpa.item.show-sql=false spring.jpa.item.hibernate.ddl-auto=none -spring.jpa.item.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.sql.item.init.mode=never spring.hibernate.item.enable_lazy_load_no_trans=true @@ -20,7 +19,6 @@ spring.datasource.basexml.driver-class-name=oracle.jdbc.OracleDriver spring.jpa.basexml.generate-ddl=false spring.jpa.basexml.show-sql=false spring.jpa.basexml.hibernate.ddl-auto=none -spring.jpa.basexml.database-platform=org.hibernate.dialect.OracleDialect spring.sql.basexml.init.mode=never spring.hibernate.basexml.enable_lazy_load_no_trans=false @@ -33,3 +31,7 @@ batch.min.hour=8 batch.max.hour=20 spring.batch.jdbc.initialize-schema=never + +# Configuration des logs +logging.level.root=INFO +logging.level.fr.abes.item=INFO diff --git a/batch/src/main/resources/application.properties b/batch/src/main/resources/application.properties index d35df33e..0a322dc6 100644 --- a/batch/src/main/resources/application.properties +++ b/batch/src/main/resources/application.properties @@ -1,8 +1,5 @@ # Configuration du projet (depuis pom.xml) spring.profiles.active=@spring.profiles.active@ -application.name=@project.artifactId@ -application.version=@project.version@ -application.basedir=@batchBaseDir@ batch.nbPpnInFileResult=5 @@ -10,4 +7,8 @@ mail.ws.url=https://apicom.sudoc.fr/wsmail/ mail.admin=item@abes.fr files.upload.path=/workdir/ -files.upload.statistiques.path=/stat/ \ No newline at end of file +files.upload.statistiques.path=/stat/ + +# Configuration des logs +logging.config=classpath:log4j2.xml +spring.main.banner-mode=off \ No newline at end of file diff --git a/batch/src/main/resources/log4j2-dev.xml b/batch/src/main/resources/log4j2-dev.xml deleted file mode 100644 index fbda63e7..00000000 --- a/batch/src/main/resources/log4j2-dev.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - ${bundle:application:application.basedir}/${bundle:application:log4j2.logdir} - ${bundle:application:application.name} - ${bundle:application:application.name}_error - ${bundle:application:application.name}_debug - - - 200 MB - 15d - 10 - 100 MB - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/batch/src/main/resources/log4j2-prod.xml b/batch/src/main/resources/log4j2-prod.xml deleted file mode 100644 index 3c71462a..00000000 --- a/batch/src/main/resources/log4j2-prod.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - ${bundle:application:application.basedir}/${bundle:application:log4j2.logdir} - ${bundle:application:application.name} - ${bundle:application:application.name}_error - ${bundle:application:application.name}_debug - - - 200 MB - 15d - 10 - 100 MB - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/batch/src/main/resources/log4j2-tests.xml b/batch/src/main/resources/log4j2-tests.xml deleted file mode 100644 index fc5e1c37..00000000 --- a/batch/src/main/resources/log4j2-tests.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - ${bundle:application:application.basedir}/${bundle:application:log4j2.logdir} - ${bundle:application:application.name} - ${bundle:application:application.name}_error - ${bundle:application:application.name}_debug - - - 200 MB - 15d - 10 - 100 MB - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/batch/src/main/resources/log4j2.xml b/batch/src/main/resources/log4j2.xml new file mode 100644 index 00000000..b7907254 --- /dev/null +++ b/batch/src/main/resources/log4j2.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/core/pom.xml b/core/pom.xml index 99bd76f7..fd77ef2b 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -27,7 +27,7 @@ com.oracle.database.jdbc ojdbc8 - 21.9.0.0 + 23.2.0.0 com.oracle.database.xml diff --git a/web/src/main/resources/application-dev.properties b/web/src/main/resources/application-dev.properties index 7c15d8fb..900c3944 100644 --- a/web/src/main/resources/application-dev.properties +++ b/web/src/main/resources/application-dev.properties @@ -5,7 +5,7 @@ spring.datasource.item.password= spring.datasource.item.driver-class-name=org.postgresql.Driver spring.jpa.item.generate-ddl=false -spring.jpa.item.show-sql=true +spring.jpa.item.show-sql=false spring.jpa.item.hibernate.ddl-auto=none spring.jpa.item.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.sql.item.init.mode=never @@ -30,9 +30,8 @@ sudoc.port= sudoc.login= # Configuration des logs -logging.config=classpath:log4j2-dev.xml logging.level.root=INFO -logging.level.fr.abes=DEBUG +logging.level.fr.abes.item=DEBUG # web service d'authentification au Sudoc # par défaut on pointe sur test car dev est branché sur rubeus qui n'est pas à jour diff --git a/web/src/main/resources/application-prod.properties b/web/src/main/resources/application-prod.properties index bded5f68..7b6036cb 100644 --- a/web/src/main/resources/application-prod.properties +++ b/web/src/main/resources/application-prod.properties @@ -5,7 +5,7 @@ spring.datasource.item.password= spring.datasource.item.driver-class-name=org.postgresql.Driver spring.jpa.item.generate-ddl=false -spring.jpa.item.show-sql=true +spring.jpa.item.show-sql=false spring.jpa.item.hibernate.ddl-auto=none spring.jpa.item.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.sql.item.init.mode=never @@ -30,9 +30,8 @@ sudoc.port= sudoc.login= # Configuration des logs -logging.config=classpath:log4j2-prod.xml -logging.level.root=INFO -logging.level.fr.abes=INFO +logging.level.root=WARN +logging.level.fr.abes.item=WARN # web service d'authentification au Sudoc wsAuthSudoc.url=https://apicom.sudoc.fr/wsAuthSudoc/authenticate diff --git a/web/src/main/resources/application-test.properties b/web/src/main/resources/application-test.properties index c1d99cc6..353d9daf 100644 --- a/web/src/main/resources/application-test.properties +++ b/web/src/main/resources/application-test.properties @@ -5,7 +5,7 @@ spring.datasource.item.password= spring.datasource.item.driver-class-name=org.postgresql.Driver spring.jpa.item.generate-ddl=false -spring.jpa.item.show-sql=true +spring.jpa.item.show-sql=false spring.jpa.item.hibernate.ddl-auto=none spring.jpa.item.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.sql.item.init.mode=never @@ -30,9 +30,8 @@ sudoc.port= sudoc.login= # Configuration des logs -logging.config=classpath:log4j2-tests.xml logging.level.root=INFO -logging.level.fr.abes=DEBUG +logging.level.fr.abes.item=INFO # web service d'authentification au Sudoc wsAuthSudoc.url=https://apicom-test.sudoc.fr/wsAuthSudoc/authenticate diff --git a/web/src/main/resources/application.properties b/web/src/main/resources/application.properties index d6abb7f5..4e7905b7 100644 --- a/web/src/main/resources/application.properties +++ b/web/src/main/resources/application.properties @@ -4,15 +4,11 @@ # Configuration du projet (depuis pom.xml) spring.profiles.active=@spring.profiles.active@ -application.name=@project.artifactId@ -application.version=@project.version@ -application.basedir=@webBaseDir@ # Configuration du serveur Http server.port=8082 # Configuration de Spring MVC pour la gestion des exceptions -spring.mvc.throw-exception-if-no-handler-found=true spring.web.resources.add-mappings=false spring.jpa.open-in-view=false @@ -20,7 +16,7 @@ batch.min.hour=8 batch.max.hour=20 # Configuration des logs -log4j2.logdir=logs +logging.config=classpath:log4j2.xml #version de l'application application.version.back=2.2 @@ -31,7 +27,7 @@ spring.servlet.multipart.max-request-size=10MB spring.servlet.multipart.enabled=true #spring logging configuration -spring.main.banner-mode=OFF +spring.main.banner-mode=off spring.output.ansi.enabled=ALWAYS files.upload.path=/workdir/ diff --git a/web/src/main/resources/log4j2-dev.xml b/web/src/main/resources/log4j2-dev.xml deleted file mode 100644 index 3f8d7fe0..00000000 --- a/web/src/main/resources/log4j2-dev.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - ${bundle:application:application.basedir}/${bundle:application:log4j2.logdir} - ${bundle:application:application.name} - ${bundle:application:application.name}_error - ${bundle:application:application.name}_debug - - - 200 MB - 15d - 10 - 100 MB - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web/src/main/resources/log4j2-prod.xml b/web/src/main/resources/log4j2-prod.xml deleted file mode 100644 index 04910e0c..00000000 --- a/web/src/main/resources/log4j2-prod.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - ${bundle:application:application.basedir}/${bundle:application:log4j2.logdir} - ${bundle:application:application.name} - ${bundle:application:application.name}_error - ${bundle:application:application.name}_debug - - - 200 MB - 15d - 10 - 100 MB - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web/src/main/resources/log4j2-tests.xml b/web/src/main/resources/log4j2-tests.xml deleted file mode 100644 index fc5e1c37..00000000 --- a/web/src/main/resources/log4j2-tests.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - ${bundle:application:application.basedir}/${bundle:application:log4j2.logdir} - ${bundle:application:application.name} - ${bundle:application:application.name}_error - ${bundle:application:application.name}_debug - - - 200 MB - 15d - 10 - 100 MB - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - %5p %d{ISO8601} [%t][%x] %c - %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/web/src/main/resources/log4j2.xml b/web/src/main/resources/log4j2.xml new file mode 100644 index 00000000..58b12fc7 --- /dev/null +++ b/web/src/main/resources/log4j2.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + +