diff --git a/.github/workflows/build-project.yml b/.github/workflows/build-project.yml index 95370327..a7d51d65 100644 --- a/.github/workflows/build-project.yml +++ b/.github/workflows/build-project.yml @@ -51,7 +51,7 @@ jobs: servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' - name: Build with Maven (Pull Request) if: ${{ github.event_name == 'pull_request' }} - run: ./mvnw -s custom_maven_settings.xml -B -Pjvm-image clean verify + run: ./mvnw -s custom_maven_settings.xml -B -Pnative-image clean verify - name: Build with Maven (Push) if: ${{ github.event_name == 'push' }} run: ./mvnw -s custom_maven_settings.xml -B clean verify diff --git a/.github/workflows/release-project.yml b/.github/workflows/release-project.yml index 20a4fd38..e9fb31d6 100644 --- a/.github/workflows/release-project.yml +++ b/.github/workflows/release-project.yml @@ -60,6 +60,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Deploy with Maven to GitHub Packages and Docker Hub - run: ./mvnw -B -s custom_maven_settings.xml -Pjvm-image,release clean deploy + run: ./mvnw -B -s custom_maven_settings.xml -Pnative-image,release clean deploy env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/app/pom.xml b/app/pom.xml index 5166dab1..1f637c31 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -107,6 +107,12 @@ SPDX-License-Identifier: Apache-2.0 io.quarkus quarkus-jdbc-postgresql + + + org.jboss.logmanager + log4j2-jboss-logmanager + + io.quarkus quarkus-container-image-docker @@ -148,11 +154,6 @@ SPDX-License-Identifier: Apache-2.0 openpojo test - - org.slf4j - slf4j-simple - test - diff --git a/app/src/main/docker/Dockerfile-basex.jvm b/app/src/main/docker/Dockerfile-basex.jvm index e64be699..e4aade5f 100644 --- a/app/src/main/docker/Dockerfile-basex.jvm +++ b/app/src/main/docker/Dockerfile-basex.jvm @@ -21,7 +21,7 @@ # docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7 +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923 ARG JAVA_PACKAGE=java-17-openjdk-headless ARG RUN_JAVA_VERSION=1.3.8 diff --git a/app/src/main/docker/Dockerfile-basex.native b/app/src/main/docker/Dockerfile-basex.native index 6f39b21f..14b0b3ec 100644 --- a/app/src/main/docker/Dockerfile-basex.native +++ b/app/src/main/docker/Dockerfile-basex.native @@ -14,7 +14,7 @@ # docker run -i --rm -p 8080:8080 quarkus/app # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7 +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ diff --git a/app/src/main/docker/Dockerfile-postgresql.jvm b/app/src/main/docker/Dockerfile-postgresql.jvm index 6f53f4eb..f37f05fa 100644 --- a/app/src/main/docker/Dockerfile-postgresql.jvm +++ b/app/src/main/docker/Dockerfile-postgresql.jvm @@ -21,7 +21,7 @@ # docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7 +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923 ARG JAVA_PACKAGE=java-17-openjdk-headless ARG RUN_JAVA_VERSION=1.3.8 diff --git a/app/src/main/docker/Dockerfile-postgresql.native b/app/src/main/docker/Dockerfile-postgresql.native index 89b835e6..1065b351 100644 --- a/app/src/main/docker/Dockerfile-postgresql.native +++ b/app/src/main/docker/Dockerfile-postgresql.native @@ -14,7 +14,7 @@ # docker run -i --rm -p 8080:8080 quarkus/app # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7 +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ diff --git a/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java b/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java index 4bec038e..ba63918a 100644 --- a/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java +++ b/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java @@ -5,19 +5,18 @@ import io.quarkus.security.Authenticated; import io.smallrye.mutiny.Uni; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.eclipse.microprofile.jwt.JsonWebToken; import org.lfenergy.compas.scl.data.rest.UserInfoProperties; import org.lfenergy.compas.scl.data.rest.v1.model.Type; import org.lfenergy.compas.scl.data.rest.v1.model.TypeListResponse; import org.lfenergy.compas.scl.data.rest.v1.model.UserInfoResponse; import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @@ -30,7 +29,7 @@ @RequestScoped @Path("/common/v1/") public class CompasCommonResource { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasCommonResource.class); + private static final Logger LOGGER = LogManager.getLogger(CompasCommonResource.class); @Inject JsonWebToken jsonWebToken; @@ -41,8 +40,8 @@ public class CompasCommonResource { @GET @Path("/type/list") @Produces(MediaType.APPLICATION_XML) - public Uni list(@HeaderParam("Authorization") String authHeader) { - LOGGER.trace("Authorization Header '{}'", authHeader); + public Uni list() { + LOGGER.info("Retrieving list of the types of SCL Files"); // Retrieve the roles the logged-in user has. var roles = jsonWebToken.getGroups(); @@ -61,9 +60,8 @@ public Uni list(@HeaderParam("Authorization") String authHeade @GET @Path("/userinfo") @Produces(MediaType.APPLICATION_XML) - public Uni getUserInfo(@HeaderParam("Authorization") String authHeader) { - LOGGER.trace("Authorization Header '{}'", authHeader); - + public Uni getUserInfo() { + LOGGER.info("Retrieving user information about {}", jsonWebToken.getName()); var response = new UserInfoResponse(); response.setName(jsonWebToken.getClaim(userInfoProperties.name())); response.setSessionWarning(userInfoProperties.sessionWarning()); diff --git a/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResource.java b/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResource.java index 4d13bbc1..f6ce9f30 100644 --- a/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResource.java +++ b/app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResource.java @@ -6,14 +6,14 @@ import io.quarkus.security.Authenticated; import io.smallrye.common.annotation.Blocking; import io.smallrye.mutiny.Uni; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.eclipse.microprofile.jwt.JsonWebToken; import org.lfenergy.compas.scl.data.model.Version; import org.lfenergy.compas.scl.data.rest.UserInfoProperties; import org.lfenergy.compas.scl.data.rest.v1.model.*; import org.lfenergy.compas.scl.data.service.CompasSclDataService; import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; @@ -28,7 +28,7 @@ @RequestScoped @Path("/scl/v1/{" + TYPE_PATH_PARAM + "}") public class CompasSclDataResource { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclDataResource.class); + private static final Logger LOGGER = LogManager.getLogger(CompasSclDataResource.class); private final CompasSclDataService compasSclDataService; @@ -49,6 +49,7 @@ public CompasSclDataResource(CompasSclDataService compasSclDataService) { @Produces(MediaType.APPLICATION_XML) public Uni create(@PathParam(TYPE_PATH_PARAM) SclFileType type, @Valid CreateRequest request) { + LOGGER.info("Adding new SCL File for type {} to storage.", type); String who = jsonWebToken.getClaim(userInfoProperties.who()); LOGGER.trace("Username used for Who {}", who); @@ -62,6 +63,7 @@ public Uni create(@PathParam(TYPE_PATH_PARAM) SclFileType type, @Path("/list") @Produces(MediaType.APPLICATION_XML) public Uni list(@PathParam(TYPE_PATH_PARAM) SclFileType type) { + LOGGER.info("Listing SCL Files for type {} from storage.", type); var response = new ListResponse(); response.setItems(compasSclDataService.list(type)); return Uni.createFrom().item(response); @@ -72,6 +74,7 @@ public Uni list(@PathParam(TYPE_PATH_PARAM) SclFileType type) { @Produces(MediaType.APPLICATION_XML) public Uni listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type, @PathParam(ID_PATH_PARAM) UUID id) { + LOGGER.info("Listing versions of SCL File {} for type {} from storage.", id, type); var response = new VersionsResponse(); response.setItems(compasSclDataService.listVersionsByUUID(type, id)); return Uni.createFrom().item(response); @@ -82,6 +85,7 @@ public Uni listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclF @Produces(MediaType.APPLICATION_XML) public Uni findByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type, @PathParam(ID_PATH_PARAM) UUID id) { + LOGGER.info("Retrieving latest version of SCL File {} for type {} from storage.", id, type); var response = new GetResponse(); response.setSclData(compasSclDataService.findByUUID(type, id)); return Uni.createFrom().item(response); @@ -93,6 +97,7 @@ public Uni findByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type, public Uni findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclFileType type, @PathParam(ID_PATH_PARAM) UUID id, @PathParam(VERSION_PATH_PARAM) Version version) { + LOGGER.info("Retrieving version {} of SCL File {} for type {} from storage.", version, id, type); var response = new GetResponse(); response.setSclData(compasSclDataService.findByUUID(type, id, version)); return Uni.createFrom().item(response); @@ -106,6 +111,7 @@ public Uni findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclFile public Uni update(@PathParam(TYPE_PATH_PARAM) SclFileType type, @PathParam(ID_PATH_PARAM) UUID id, @Valid UpdateRequest request) { + LOGGER.info("Updating SCL File {} for type {} to storage.", id, type); String who = jsonWebToken.getClaim(userInfoProperties.who()); LOGGER.trace("Username used for Who {}", who); @@ -121,6 +127,7 @@ public Uni update(@PathParam(TYPE_PATH_PARAM) SclFileType type, @Produces(MediaType.APPLICATION_XML) public Uni deleteAll(@PathParam(TYPE_PATH_PARAM) SclFileType type, @PathParam(ID_PATH_PARAM) UUID id) { + LOGGER.info("Removing all versions of SCL File {} for type {} from storage.", id, type); compasSclDataService.delete(type, id); return Uni.createFrom().nullItem(); } @@ -132,6 +139,7 @@ public Uni deleteAll(@PathParam(TYPE_PATH_PARAM) SclFileType type, public Uni deleteVersion(@PathParam(TYPE_PATH_PARAM) SclFileType type, @PathParam(ID_PATH_PARAM) UUID id, @PathParam(VERSION_PATH_PARAM) Version version) { + LOGGER.info("Removing version {} of SCL File {} for type {} from storage.", version, id, type); compasSclDataService.delete(type, id, version); return Uni.createFrom().nullItem(); } diff --git a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpoint.java b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpoint.java index 3f520550..8962d88c 100644 --- a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpoint.java +++ b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpoint.java @@ -5,6 +5,8 @@ import io.quarkus.security.Authenticated; import io.vertx.mutiny.core.eventbus.EventBus; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.eclipse.microprofile.jwt.JsonWebToken; import org.lfenergy.compas.core.websocket.ErrorResponseEncoder; import org.lfenergy.compas.scl.data.rest.UserInfoProperties; @@ -13,11 +15,10 @@ import org.lfenergy.compas.scl.data.websocket.v1.encoder.CreateWsResponseEncoder; import org.lfenergy.compas.scl.data.websocket.v1.model.CreateWsRequest; import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; +import javax.validation.Valid; import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; @@ -31,7 +32,7 @@ decoders = {CreateWsRequestDecoder.class}, encoders = {CreateWsResponseEncoder.class, ErrorResponseEncoder.class}) public class CompasSclCreateServerEndpoint { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclCreateServerEndpoint.class); + private static final Logger LOGGER = LogManager.getLogger(CompasSclCreateServerEndpoint.class); private final EventBus eventBus; private final JsonWebToken jsonWebToken; @@ -52,7 +53,9 @@ public void onOpen(Session session, @PathParam(TYPE_PATH_PARAM) String type) { } @OnMessage - public void onCreateMessage(Session session, CreateWsRequest request, @PathParam(TYPE_PATH_PARAM) String type) { + public void onCreateMessage(Session session, + @Valid CreateWsRequest request, + @PathParam(TYPE_PATH_PARAM) String type) { LOGGER.info("Message (create) from session {} for type {}.", session.getId(), type); String who = jsonWebToken.getClaim(userInfoProperties.who()); diff --git a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpoint.java b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpoint.java index 1f5fa11a..2d66f1bc 100644 --- a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpoint.java +++ b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetServerEndpoint.java @@ -5,17 +5,18 @@ import io.quarkus.security.Authenticated; import io.vertx.mutiny.core.eventbus.EventBus; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lfenergy.compas.core.websocket.ErrorResponseEncoder; import org.lfenergy.compas.scl.data.websocket.event.model.GetEventRequest; import org.lfenergy.compas.scl.data.websocket.v1.decoder.GetWsRequestDecoder; import org.lfenergy.compas.scl.data.websocket.v1.encoder.GetWsResponseEncoder; import org.lfenergy.compas.scl.data.websocket.v1.model.GetWsRequest; import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; +import javax.validation.Valid; import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; @@ -29,7 +30,7 @@ decoders = {GetWsRequestDecoder.class}, encoders = {GetWsResponseEncoder.class, ErrorResponseEncoder.class}) public class CompasSclGetServerEndpoint { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclGetServerEndpoint.class); + private static final Logger LOGGER = LogManager.getLogger(CompasSclGetServerEndpoint.class); private final EventBus eventBus; @@ -45,7 +46,7 @@ public void onOpen(Session session, @PathParam(TYPE_PATH_PARAM) String type) { @OnMessage public void onGetMessage(Session session, - GetWsRequest request, + @Valid GetWsRequest request, @PathParam(TYPE_PATH_PARAM) String type) { LOGGER.info("Message (get) from session {} for type {}.", session.getId(), type); diff --git a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpoint.java b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpoint.java index 7d7b361a..866941fa 100644 --- a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpoint.java +++ b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclGetVersionServerEndpoint.java @@ -5,6 +5,8 @@ import io.quarkus.security.Authenticated; import io.vertx.mutiny.core.eventbus.EventBus; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lfenergy.compas.core.websocket.ErrorResponseEncoder; import org.lfenergy.compas.scl.data.model.Version; import org.lfenergy.compas.scl.data.websocket.event.model.GetVersionEventRequest; @@ -12,11 +14,10 @@ import org.lfenergy.compas.scl.data.websocket.v1.encoder.GetWsResponseEncoder; import org.lfenergy.compas.scl.data.websocket.v1.model.GetVersionWsRequest; import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; +import javax.validation.Valid; import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; @@ -30,7 +31,7 @@ decoders = {GetVersionWsRequestDecoder.class}, encoders = {GetWsResponseEncoder.class, ErrorResponseEncoder.class}) public class CompasSclGetVersionServerEndpoint { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclGetVersionServerEndpoint.class); + private static final Logger LOGGER = LogManager.getLogger(CompasSclGetVersionServerEndpoint.class); private final EventBus eventBus; @@ -46,7 +47,7 @@ public void onOpen(Session session, @PathParam(TYPE_PATH_PARAM) String type) { @OnMessage public void onGetVersionMessage(Session session, - GetVersionWsRequest request, + @Valid GetVersionWsRequest request, @PathParam(TYPE_PATH_PARAM) String type) { LOGGER.info("Message from session {} for type {}.", session.getId(), type); diff --git a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpoint.java b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpoint.java index d0db47bc..d54dfc77 100644 --- a/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpoint.java +++ b/app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclUpdateServerEndpoint.java @@ -5,6 +5,8 @@ import io.quarkus.security.Authenticated; import io.vertx.mutiny.core.eventbus.EventBus; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.eclipse.microprofile.jwt.JsonWebToken; import org.lfenergy.compas.core.websocket.ErrorResponseEncoder; import org.lfenergy.compas.scl.data.rest.UserInfoProperties; @@ -13,11 +15,10 @@ import org.lfenergy.compas.scl.data.websocket.v1.encoder.UpdateWsResponseEncoder; import org.lfenergy.compas.scl.data.websocket.v1.model.UpdateWsRequest; import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; +import javax.validation.Valid; import javax.websocket.*; import javax.websocket.server.PathParam; import javax.websocket.server.ServerEndpoint; @@ -31,7 +32,7 @@ decoders = {UpdateWsRequestDecoder.class}, encoders = {UpdateWsResponseEncoder.class, ErrorResponseEncoder.class}) public class CompasSclUpdateServerEndpoint { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclUpdateServerEndpoint.class); + private static final Logger LOGGER = LogManager.getLogger(CompasSclUpdateServerEndpoint.class); private final EventBus eventBus; private final JsonWebToken jsonWebToken; @@ -52,7 +53,8 @@ public void onOpen(Session session, @PathParam(TYPE_PATH_PARAM) String type) { } @OnMessage - public void onUpdateMessage(Session session, UpdateWsRequest request, + public void onUpdateMessage(Session session, + @Valid UpdateWsRequest request, @PathParam(TYPE_PATH_PARAM) String type) { LOGGER.info("Message (update) from session {} for type {}.", session.getId(), type); diff --git a/app/src/main/resources/application.properties b/app/src/main/resources/application.properties index 61a07aae..07b1add8 100644 --- a/app/src/main/resources/application.properties +++ b/app/src/main/resources/application.properties @@ -16,9 +16,6 @@ quarkus.log.level = INFO quarkus.log.category."org.lfenergy.compas.scl.data".level = INFO # Add scanning these dependencies for scanning, also used by native compilation. -quarkus.index-dependency.hibernate-validator.group-id=org.hibernate.validator -quarkus.index-dependency.hibernate-validator.artifact-id=hibernate-validator - quarkus.index-dependency.websocket-commons.group-id = org.lfenergy.compas.core quarkus.index-dependency.websocket-commons.artifact-id = websocket-commons diff --git a/app/src/test/resources/simplelogger.properties b/app/src/test/resources/simplelogger.properties deleted file mode 100644 index 684f66ea..00000000 --- a/app/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Alliander N.V. -# -# SPDX-License-Identifier: Apache-2.0 - -# SLF4J's SimpleLogger configuration file -# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. - -org.slf4j.simpleLogger.showThreadName=true -org.slf4j.simpleLogger.showLogName=true -org.slf4j.simpleLogger.showShortLogName=true -org.slf4j.simpleLogger.showDateTime=true -org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss - -org.slf4j.simpleLogger.defaultLogLevel=debug diff --git a/pom.xml b/pom.xml index ae730342..b4b80c87 100644 --- a/pom.xml +++ b/pom.xml @@ -23,12 +23,12 @@ SPDX-License-Identifier: Apache-2.0 3.0.0-M7 3.2.0 - 0.10.2 + 0.12.0 - 2.14.0.Final + 2.14.1.Final 2.3.7 - 3.0 - 2.0.3 + 3.1 + 2.19.0 0.9.1 @@ -121,14 +121,20 @@ SPDX-License-Identifier: Apache-2.0 - org.slf4j - slf4j-api - ${slf4j.version} + org.apache.logging.log4j + log4j-api + ${log4j2.version} - org.slf4j - slf4j-simple - ${slf4j.version} + org.apache.logging.log4j + log4j-core + ${log4j2.version} + + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j2.version} diff --git a/repository-basex/pom.xml b/repository-basex/pom.xml index 8153930f..c6452608 100644 --- a/repository-basex/pom.xml +++ b/repository-basex/pom.xml @@ -42,6 +42,16 @@ SPDX-License-Identifier: Apache-2.0 provided + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + provided + + org.lfenergy.compas.scl.data @@ -71,11 +81,6 @@ SPDX-License-Identifier: Apache-2.0 junit-jupiter-engine test - - org.slf4j - slf4j-simple - test - diff --git a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java b/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java index 4a21a006..65f52043 100644 --- a/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java +++ b/repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java @@ -4,6 +4,8 @@ package org.lfenergy.compas.scl.data.basex.repository; import org.apache.commons.io.input.ReaderInputStream; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lfenergy.compas.scl.data.basex.client.BaseXClient; import org.lfenergy.compas.scl.data.basex.client.BaseXClientFactory; import org.lfenergy.compas.scl.data.exception.CompasNoDataFoundException; @@ -15,8 +17,6 @@ import org.lfenergy.compas.scl.data.repository.CompasSclDataRepository; import org.lfenergy.compas.scl.data.util.SclDataModelMarshaller; import org.lfenergy.compas.scl.extensions.model.SclFileType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @@ -48,7 +48,7 @@ */ @ApplicationScoped public class CompasSclDataBaseXRepository implements CompasSclDataRepository { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclDataBaseXRepository.class); + private static final Logger LOGGER = LogManager.getLogger(CompasSclDataBaseXRepository.class); private static final String DECLARE_NS_AND_VARS = """ declare namespace scl = "%s"; diff --git a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepositoryTest.java b/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepositoryTest.java index c9e82dd1..693cc194 100644 --- a/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepositoryTest.java +++ b/repository-basex/src/test/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepositoryTest.java @@ -3,6 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 package org.lfenergy.compas.scl.data.basex.repository; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,8 +16,6 @@ import org.lfenergy.compas.scl.data.util.SclDataModelMarshaller; import org.lfenergy.compas.scl.extensions.model.SclFileType; import org.mockito.junit.jupiter.MockitoExtension; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Arrays; @@ -25,7 +25,7 @@ @ExtendWith({MockitoExtension.class, BaseXServerJUnitExtension.class}) class CompasSclDataBaseXRepositoryTest extends AbstractCompasSclDataRepositoryTest { - private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclDataBaseXRepositoryTest.class); + private static final Logger LOGGER = LogManager.getLogger(CompasSclDataBaseXRepositoryTest.class); private static BaseXClientFactory factory; private CompasSclDataBaseXRepository repository; diff --git a/repository-basex/src/test/resources/log4j2.xml b/repository-basex/src/test/resources/log4j2.xml new file mode 100644 index 00000000..3b41fa7f --- /dev/null +++ b/repository-basex/src/test/resources/log4j2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/repository-basex/src/test/resources/simplelogger.properties b/repository-basex/src/test/resources/simplelogger.properties deleted file mode 100644 index 684f66ea..00000000 --- a/repository-basex/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Alliander N.V. -# -# SPDX-License-Identifier: Apache-2.0 - -# SLF4J's SimpleLogger configuration file -# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. - -org.slf4j.simpleLogger.showThreadName=true -org.slf4j.simpleLogger.showLogName=true -org.slf4j.simpleLogger.showShortLogName=true -org.slf4j.simpleLogger.showDateTime=true -org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss - -org.slf4j.simpleLogger.defaultLogLevel=debug diff --git a/repository-postgresql/pom.xml b/repository-postgresql/pom.xml index 48ee8d90..f531369f 100644 --- a/repository-postgresql/pom.xml +++ b/repository-postgresql/pom.xml @@ -23,6 +23,22 @@ SPDX-License-Identifier: Apache-2.0 repository + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + provided + + + + org.apache.logging.log4j + log4j-slf4j-impl + provided + + org.lfenergy.compas.scl.data @@ -63,11 +79,6 @@ SPDX-License-Identifier: Apache-2.0 junit-jupiter-engine test - - org.slf4j - slf4j-simple - test - diff --git a/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java b/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java index c51f5da8..be51c4a1 100644 --- a/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java +++ b/repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgresql/PostgreSQLServerJUnitExtension.java @@ -4,11 +4,11 @@ package org.lfenergy.compas.scl.data.repository.postgresql; import com.opentable.db.postgres.embedded.EmbeddedPostgres; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.flywaydb.core.Flyway; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.ExtensionContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.sql.DataSource; import java.io.IOException; @@ -22,7 +22,7 @@ * JUnit Tests. */ public class PostgreSQLServerJUnitExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { - private static final Logger LOGGER = LoggerFactory.getLogger(PostgreSQLServerJUnitExtension.class); + private static final Logger LOGGER = LogManager.getLogger(PostgreSQLServerJUnitExtension.class); private static EmbeddedPostgres pg; diff --git a/repository-postgresql/src/test/resources/log4j2.xml b/repository-postgresql/src/test/resources/log4j2.xml new file mode 100644 index 00000000..3b41fa7f --- /dev/null +++ b/repository-postgresql/src/test/resources/log4j2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/repository/pom.xml b/repository/pom.xml index 16ce3fb9..7919d8df 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -51,8 +51,13 @@ SPDX-License-Identifier: Apache-2.0 - org.slf4j - slf4j-api + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + provided @@ -71,11 +76,6 @@ SPDX-License-Identifier: Apache-2.0 openpojo test - - org.slf4j - slf4j-simple - test - diff --git a/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclDataModelMarshaller.java b/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclDataModelMarshaller.java index db6784cb..57c3a721 100644 --- a/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclDataModelMarshaller.java +++ b/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclDataModelMarshaller.java @@ -3,12 +3,12 @@ // SPDX-License-Identifier: Apache-2.0 package org.lfenergy.compas.scl.data.util; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lfenergy.compas.scl.data.exception.CompasSclDataServiceException; import org.lfenergy.compas.scl.data.model.HistoryItem; import org.lfenergy.compas.scl.data.model.Item; import org.lfenergy.compas.scl.data.model.SclMetaInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -20,7 +20,7 @@ import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.UNMARSHAL_ERROR_CODE; public class SclDataModelMarshaller { - private static final Logger LOGGER = LoggerFactory.getLogger(SclDataModelMarshaller.class); + private static final Logger LOGGER = LogManager.getLogger(SclDataModelMarshaller.class); private final Unmarshaller jaxbUnmarshaller; diff --git a/repository/src/test/resources/log4j2.xml b/repository/src/test/resources/log4j2.xml new file mode 100644 index 00000000..3b41fa7f --- /dev/null +++ b/repository/src/test/resources/log4j2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/service/pom.xml b/service/pom.xml index 09f24b63..7eccb476 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -33,6 +33,16 @@ SPDX-License-Identifier: Apache-2.0 jakarta.enterprise.cdi-api + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + provided + + org.mockito @@ -44,11 +54,6 @@ SPDX-License-Identifier: Apache-2.0 junit-jupiter-engine test - - org.slf4j - slf4j-simple - test - diff --git a/service/src/test/resources/log4j2.xml b/service/src/test/resources/log4j2.xml new file mode 100644 index 00000000..3b41fa7f --- /dev/null +++ b/service/src/test/resources/log4j2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + +