From f7d99aea42c7cf4981b574c8fa619aa72bacb94b Mon Sep 17 00:00:00 2001 From: Pavel Vetokhin Date: Sun, 17 Mar 2024 11:28:54 +0300 Subject: [PATCH] Setup gear logging (#412) --- README.adoc | 1 + app/pom.xml | 14 +++---- .../src/it/resources/logback-test.xml | 11 ------ .../bezmen/core/SepulkaServiceImpl.java | 2 +- .../src/it/resources/logback-test.xml | 11 ------ .../bezmen/core/SepulkaServiceImpl.kt | 2 +- .../src/it/resources/logback-test.xml | 11 ------ lib/pom.xml | 9 ++++- lib/storage/src/it/resources/logback-test.xml | 11 ------ .../src/test/resources/logback-test.xml | 11 ------ pom.xml | 8 +++- test/e2e/src/test/resources/logback-test.xml | 11 ------ test/pom.xml | 7 ---- tool/pom.xml | 37 +++---------------- tool/testing/pom.xml | 19 +++++++++- tool/testing/src/main/resources/log4j2.xml | 17 +++++++++ tool/testing/src/main/resources/logback.xml | 13 +++++++ 17 files changed, 78 insertions(+), 117 deletions(-) delete mode 100644 app/sepuling-java/src/it/resources/logback-test.xml delete mode 100644 app/sepuling-kotlin/src/it/resources/logback-test.xml delete mode 100644 lib/messaging/src/it/resources/logback-test.xml delete mode 100644 lib/storage/src/it/resources/logback-test.xml delete mode 100644 lib/storage/src/test/resources/logback-test.xml delete mode 100644 test/e2e/src/test/resources/logback-test.xml create mode 100644 tool/testing/src/main/resources/log4j2.xml create mode 100644 tool/testing/src/main/resources/logback.xml diff --git a/README.adoc b/README.adoc index cff11ed5..77368e57 100644 --- a/README.adoc +++ b/README.adoc @@ -8,6 +8,7 @@ . Адаптируем имена (find & replace) .. Имя проекта (в шаблоне bezmen) .. Имя приложения (в шаблоне sepuling) +.. Имя базы данных (в шаблоне enteropia) .. Имя схемы данных (в шаблоне sepulkarium) . Настраиваем синхронизацию .. Создаем Github App на уровне репозитория или организации diff --git a/app/pom.xml b/app/pom.xml index 4bd6d59d..08ae9c5c 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -66,7 +66,7 @@ maven-dependency-plugin - deps-jars + copy-deps pre-integration-test copy-dependencies @@ -74,11 +74,11 @@ runtime ${project.groupId} - ${project.build.directory}/image-context/lib + ${project.build.directory}/image/lib - libs-jars + copy-libs pre-integration-test copy-dependencies @@ -86,11 +86,11 @@ runtime ${project.groupId} - ${project.build.directory}/image-context/bin + ${project.build.directory}/image/bin - app-jar + copy-app pre-integration-test copy @@ -101,7 +101,7 @@ ${project.groupId} ${project.artifactId} ${project.version} - ${project.build.directory}/image-context/bin + ${project.build.directory}/image/bin @@ -124,7 +124,7 @@ docker build - ${project.build.directory}/image-context + ${project.build.directory}/image --file ${project.basedir}/Dockerfile --tag diff --git a/app/sepuling-java/src/it/resources/logback-test.xml b/app/sepuling-java/src/it/resources/logback-test.xml deleted file mode 100644 index 885aa3cb..00000000 --- a/app/sepuling-java/src/it/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/app/sepuling-java/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java b/app/sepuling-java/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java index 33ad4de4..78f01e7c 100644 --- a/app/sepuling-java/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java +++ b/app/sepuling-java/src/main/java/smecalculus/bezmen/core/SepulkaServiceImpl.java @@ -41,6 +41,6 @@ public RegistrationResponse register(RegistrationRequest request) { public ViewingResponse view(SepulkaMessageDm.ViewingRequest request) { LOG.debug("Handling sepulka viewing request: {}", request); var state = dao.getBy(request.internalId()); - return state.map(factory::newMessage).orElseThrow(RuntimeException::new); + return state.map(factory::newMessage).orElseThrow(() -> new RuntimeException("NotFoundException")); } } diff --git a/app/sepuling-kotlin/src/it/resources/logback-test.xml b/app/sepuling-kotlin/src/it/resources/logback-test.xml deleted file mode 100644 index 885aa3cb..00000000 --- a/app/sepuling-kotlin/src/it/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/app/sepuling-kotlin/src/main/kotlin/smecalculus/bezmen/core/SepulkaServiceImpl.kt b/app/sepuling-kotlin/src/main/kotlin/smecalculus/bezmen/core/SepulkaServiceImpl.kt index 31c1a9bd..7e8b3ff2 100644 --- a/app/sepuling-kotlin/src/main/kotlin/smecalculus/bezmen/core/SepulkaServiceImpl.kt +++ b/app/sepuling-kotlin/src/main/kotlin/smecalculus/bezmen/core/SepulkaServiceImpl.kt @@ -27,6 +27,6 @@ class SepulkaServiceImpl( override fun view(request: ViewingRequest): ViewingResponse { val state = dao.getBy(request.internalId) - return state?.let { factory.newMessage(it) } ?: throw RuntimeException() + return state?.let { factory.newMessage(it) } ?: throw RuntimeException("NotFoundException") } } diff --git a/lib/messaging/src/it/resources/logback-test.xml b/lib/messaging/src/it/resources/logback-test.xml deleted file mode 100644 index 885aa3cb..00000000 --- a/lib/messaging/src/it/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/lib/pom.xml b/lib/pom.xml index 02cca27a..a9462bfd 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -96,8 +96,10 @@ org.slf4j - slf4j-api + slf4j-bom 2.0.12 + import + pom ch.qos.logback @@ -195,6 +197,11 @@ h2 2.2.224 + + net.bytebuddy + byte-buddy + 1.14.12 + diff --git a/lib/storage/src/it/resources/logback-test.xml b/lib/storage/src/it/resources/logback-test.xml deleted file mode 100644 index 885aa3cb..00000000 --- a/lib/storage/src/it/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/lib/storage/src/test/resources/logback-test.xml b/lib/storage/src/test/resources/logback-test.xml deleted file mode 100644 index 885aa3cb..00000000 --- a/lib/storage/src/test/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/pom.xml b/pom.xml index d57c5bf8..39d62d7d 100644 --- a/pom.xml +++ b/pom.xml @@ -275,6 +275,9 @@ junit.jupiter.execution.parallel.config.fixed.parallelism=2 + + org.apache.logging.log4j.jul.LogManager + @@ -302,6 +305,9 @@ junit.jupiter.execution.parallel.enabled=false + + org.apache.logging.log4j.jul.LogManager + @@ -367,7 +373,7 @@ maven-deploy-plugin 3.1.1 - true + true diff --git a/test/e2e/src/test/resources/logback-test.xml b/test/e2e/src/test/resources/logback-test.xml deleted file mode 100644 index 885aa3cb..00000000 --- a/test/e2e/src/test/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/test/pom.xml b/test/pom.xml index 7733a945..f8b86a49 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -27,13 +27,6 @@ - - ${project.groupId} - lib - ${revision} - import - pom - ${project.groupId} tool diff --git a/tool/pom.xml b/tool/pom.xml index a8d28c63..1ff7a14e 100644 --- a/tool/pom.xml +++ b/tool/pom.xml @@ -29,13 +29,10 @@ ${project.groupId} - abstraction-client + lib ${revision} - - - org.projectlombok - lombok - ${lombok.version} + import + pom com.github.docker-java @@ -71,19 +68,9 @@ pom - org.slf4j - slf4j-api - 2.0.12 - - - ch.qos.logback - logback-classic - 1.5.3 - - - com.fasterxml.jackson - jackson-bom - 2.17.0 + org.apache.logging.log4j + log4j-bom + 2.23.1 import pom @@ -92,23 +79,11 @@ jakarta.servlet-api 6.0.0 - - org.springframework - spring-framework-bom - 6.1.5 - import - pom - org.awaitility awaitility 4.2.1 - - net.bytebuddy - byte-buddy - 1.14.12 - diff --git a/tool/testing/pom.xml b/tool/testing/pom.xml index 6f4abde7..2ebd5702 100644 --- a/tool/testing/pom.xml +++ b/tool/testing/pom.xml @@ -48,8 +48,23 @@ - ch.qos.logback - logback-classic + org.apache.logging.log4j + log4j-api + runtime + + + org.apache.logging.log4j + log4j-core + runtime + + + org.apache.logging.log4j + log4j-slf4j2-impl + runtime + + + org.apache.logging.log4j + log4j-jul runtime diff --git a/tool/testing/src/main/resources/log4j2.xml b/tool/testing/src/main/resources/log4j2.xml new file mode 100644 index 00000000..3570db2e --- /dev/null +++ b/tool/testing/src/main/resources/log4j2.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tool/testing/src/main/resources/logback.xml b/tool/testing/src/main/resources/logback.xml new file mode 100644 index 00000000..aec6a480 --- /dev/null +++ b/tool/testing/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg%n + + + + + + +