diff options
author | Thomas <> | 2023-03-23 17:24:53 +0100 |
---|---|---|
committer | Thomas <> | 2023-06-05 17:05:35 +0200 |
commit | d39f2b7b7b4e2fea2a5402c63c10d3ce83097129 (patch) | |
tree | 969204495c98ac53b6e43e6bc98b5b1184eef52d /ms_specific_connector/src/main | |
parent | af37413f909cd9a65c260d04e7921003336ed143 (diff) | |
download | National_eIDAS_Gateway-d39f2b7b7b4e2fea2a5402c63c10d3ce83097129.tar.gz National_eIDAS_Gateway-d39f2b7b7b4e2fea2a5402c63c10d3ce83097129.tar.bz2 National_eIDAS_Gateway-d39f2b7b7b4e2fea2a5402c63c10d3ce83097129.zip |
chore(core): update statistic logger as requested by the BM.I
Diffstat (limited to 'ms_specific_connector/src/main')
-rw-r--r-- | ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java (renamed from ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisicLogger.java) | 24 | ||||
-rw-r--r-- | ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java | 4 |
2 files changed, 17 insertions, 11 deletions
diff --git a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisicLogger.java b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java index cfa93286..06fb1aba 100644 --- a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisicLogger.java +++ b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java @@ -1,5 +1,6 @@ package at.asitplus.eidas.specific.core.logger; +import java.io.IOException; import java.time.LocalDateTime; import org.apache.commons.lang3.StringUtils; @@ -8,10 +9,10 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; @@ -36,13 +37,14 @@ import lombok.extern.slf4j.Slf4j; * */ @Slf4j -public class AdvancedStatisicLogger implements IStatisticLogger { +public class AdvancedStatisticLogger implements IStatisticLogger { - private static final String DATEFORMATER = "yyyy.MM.dd-HH:mm:ss"; + private static final String DATEFORMATER = "yyyy.MM.dd-HH:mm:ss,SSS"; private static final String DEFAULT_NO_IDP_ID = "no idpId available"; private static final String DEFAULT_NO_SP_ID = "no appId available"; private static final ObjectMapper mapper = new ObjectMapper(); + private static final JavaPropsMapper propsMapper = new JavaPropsMapper(); private final IStatusMessenger messageService; @@ -51,7 +53,7 @@ public class AdvancedStatisicLogger implements IStatisticLogger { * * @param source i18n message source */ - public AdvancedStatisicLogger(IStatusMessenger source) { + public AdvancedStatisticLogger(IStatusMessenger source) { this.messageService = source; } @@ -61,6 +63,7 @@ public class AdvancedStatisicLogger implements IStatisticLogger { final StatisticLogEntry entry = buildCoreEntry(protocolRequest); entry.setSuccess(SuccessEntry.builder() .spSector(protocolRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier()) + .spCountry("AT") .citizenCountryCode(authData.getCiticenCountryCode()) .build()); entry.setMatching(MatchingDetails.builder() @@ -132,9 +135,9 @@ public class AdvancedStatisicLogger implements IStatisticLogger { private void writeEntryToLog(StatisticLogEntry entry) { try { - log.info(mapper.writeValueAsString(entry)); + log.info(mapper.writeValueAsString(propsMapper.writeValueAsProperties(entry))); - } catch (final JsonProcessingException e) { + } catch (final IOException e) { log.error("Can NOT generate statistic entry for logging", e); } @@ -162,13 +165,13 @@ public class AdvancedStatisicLogger implements IStatisticLogger { @JsonProperty("unique-sp-id") private final String uniqueId; - @JsonProperty("success") + @JsonProperty("result") private SuccessEntry success; @JsonProperty("error") private ErrorEntry error; - @JsonProperty("idenityMatching") + @JsonProperty("identityMatching") private MatchingDetails matching; } @@ -182,7 +185,10 @@ public class AdvancedStatisicLogger implements IStatisticLogger { @JsonProperty("spSector") private final String spSector; - @JsonProperty("ccc") + @JsonProperty("spCountry") + private final String spCountry; + + @JsonProperty("citizenCountryCode") private final String citizenCountryCode; } diff --git a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java index 008a5691..723da3ba 100644 --- a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java +++ b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java @@ -23,7 +23,7 @@ public class MultipleStatisticLogger implements IStatisticLogger { private final Set<IStatisticLogger> internalLoggers; /** - * Build a statistic logger that logs into {@link StatisticLogger} and {@link AdvancedStatisicLogger}. + * Build a statistic logger that logs into {@link StatisticLogger} and {@link AdvancedStatisticLogger}. * * @param messageService i18n message-source implementation. */ @@ -31,7 +31,7 @@ public class MultipleStatisticLogger implements IStatisticLogger { internalLoggers = Collections.unmodifiableSet( Sets.newHashSet( new StatisticLogger(), - new AdvancedStatisicLogger(messageService))); + new AdvancedStatisticLogger(messageService))); } |