diff --git a/src/main/java/com/evolveum/midpoint/integration/catalog/IntegrationCatalogApplication.java b/src/main/java/com/evolveum/midpoint/integration/catalog/IntegrationCatalogApplication.java index 6b817cb..7a545c8 100644 --- a/src/main/java/com/evolveum/midpoint/integration/catalog/IntegrationCatalogApplication.java +++ b/src/main/java/com/evolveum/midpoint/integration/catalog/IntegrationCatalogApplication.java @@ -6,9 +6,11 @@ package com.evolveum.midpoint.integration.catalog; +import ch.qos.logback.classic.Logger; import com.evolveum.midpoint.integration.catalog.configuration.GithubProperties; import com.evolveum.midpoint.integration.catalog.configuration.JenkinsProperties; import com.evolveum.midpoint.integration.catalog.repository.ApplicationRepository; +import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -23,9 +25,13 @@ public static void main(String[] args) { SpringApplication.run(IntegrationCatalogApplication.class, args); } + private static final Logger LOG + = (Logger) LoggerFactory.getLogger(IntegrationCatalogApplication.class); + //check if DB is connected - 0=fine @Bean CommandLineRunner pingDb(ApplicationRepository repo) { - return args -> System.out.println("✅ Applications in DB: " + repo.count()); + LOG.info("Applications in DB: " + repo.count()); + return args -> System.out.println("Applications in DB: " + repo.count()); } } diff --git a/src/main/java/com/evolveum/midpoint/integration/catalog/service/ApplicationService.java b/src/main/java/com/evolveum/midpoint/integration/catalog/service/ApplicationService.java index 4517a08..1fda9f2 100644 --- a/src/main/java/com/evolveum/midpoint/integration/catalog/service/ApplicationService.java +++ b/src/main/java/com/evolveum/midpoint/integration/catalog/service/ApplicationService.java @@ -6,6 +6,8 @@ package com.evolveum.midpoint.integration.catalog.service; +import ch.qos.logback.classic.Logger; +import com.evolveum.midpoint.integration.catalog.IntegrationCatalogApplication; import com.evolveum.midpoint.integration.catalog.dto.*; import com.evolveum.midpoint.integration.catalog.common.ItemFile; import com.evolveum.midpoint.integration.catalog.mapper.ApplicationMapper; @@ -23,6 +25,7 @@ import lombok.extern.slf4j.Slf4j; import org.kohsuke.github.GHRepository; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -53,6 +56,9 @@ @Service public class ApplicationService { + private static final Logger LOG + = (Logger) LoggerFactory.getLogger(ApplicationService.class); + private static final long DOWNLOAD_OFFSET_SECONDS = 10; @Autowired @@ -601,6 +607,7 @@ public byte[] downloadConnector(UUID versionId, String ip, String userAgent) thr version.getBundleVersion().getDownloadLink() : null; if (downloadLink == null || downloadLink.isEmpty()) { + throw new IllegalArgumentException("No download link available for version: " + versionId); } @@ -748,6 +755,7 @@ public Boolean verify(VerifyBundleInformationForm verifiPayload) { if (connectorBundle.isEmpty()) { err = "No bundle found containing the connector Implementation version with OID " + implementationVersionId + "."; + throw new ResponseStatusException(HttpStatus.NOT_FOUND, err); } @@ -804,6 +812,7 @@ public Boolean verify(VerifyBundleInformationForm verifiPayload) { } catch (Exception e) { err = e.getLocalizedMessage(); + LOG.error(err); sourceImplementationVersion.setErrorMessage(err); throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, err); } @@ -819,6 +828,7 @@ public Boolean verify(VerifyBundleInformationForm verifiPayload) { } catch (Exception e) { err = e.getLocalizedMessage(); + LOG.error(err); sourceImplementationVersion.setErrorMessage(err); throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, err); } @@ -851,6 +861,8 @@ public void moveImplVersionAndDeleteConnectorBundle(ConnectorBundle sourceBundle BundleVersion targetBundleVersion, ImplementationVersion sourceImplementationVersion) { if (sourceBundle.getBundleName() != null && !sourceBundle.getBundleName().isEmpty()) { + LOG.error("Illegal state of connector bundle. Bundle already contains implementation version " + + "which is being verified"); throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Illegal state of connector" + " bundle. Bundle already contains implementation version which is being verified"); diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 0000000..ce8c8ad --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,15 @@ + + _____ _ _ _ _____ _ _ + |_ _| | | | | (_) / ____| | | | | + | | _ __ | |_ ___ __ _ _ __ __ _| |_ _ ___ _ __ | | __ _| |_ __ _| | ___ __ _ + | | | '_ \| __/ _ \/ _` | '__/ _` | __| |/ _ \| '_ \ | | / _` | __/ _` | |/ _ \ / _` | + _| |_| | | | || __/ (_| | | | (_| | |_| | (_) | | | | | |___| (_| | || (_| | | (_) | (_| | + |_____|_| |_|\__\___|\__, |_| \__,_|\__|_|\___/|_| |_| \_____\__,_|\__\__,_|_|\___/ \__, | + __/ | __/ | + |___/ |___/ by Evolveum and partners + + Licensed under the EUPL-1.2 or later. + Version: ${project.version} + Sources: https://github.com/Evolveum/integration-catalog, branch: ${git.branch}, build: ${git.describe} + Bug reporting system: ${project.issueManagement.url} + Product information: https://midpoint.evolveum.com diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml new file mode 100644 index 0000000..8009830 --- /dev/null +++ b/src/main/resources/log4j.xml @@ -0,0 +1,35 @@ + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %class{36}.%M %L - %msg%n + + + + + integration-catalog.log + + app.%d{yyyy-MM-dd-mm}.%i.log.zip + 20 + + + 10MB + + + %d{HH:mm:ss.SSS} [%thread] %-5level %class{36}.%M %L - %msg%n + + + + + + + + + + + + + + + \ No newline at end of file