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_proxyservice/src/main/java/at/asitplus/eidas/specific | |
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_proxyservice/src/main/java/at/asitplus/eidas/specific')
-rw-r--r-- | ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/AdvancedStatisticLogger.java (renamed from ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/AdvancedStatisicLogger.java) | 20 | ||||
-rw-r--r-- | ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/MultipleStatisticLogger.java | 4 |
2 files changed, 15 insertions, 9 deletions
diff --git a/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/AdvancedStatisicLogger.java b/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/AdvancedStatisticLogger.java index cf55281d..55833b8b 100644 --- a/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/AdvancedStatisicLogger.java +++ b/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/AdvancedStatisticLogger.java @@ -1,15 +1,16 @@ package at.asitplus.eidas.specific.proxy.logger; +import java.io.IOException; import java.time.LocalDateTime; 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; @@ -33,12 +34,13 @@ 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 ObjectMapper mapper = new ObjectMapper(); + private static final JavaPropsMapper propsMapper = new JavaPropsMapper(); private final IStatusMessenger messageService; @@ -47,7 +49,7 @@ public class AdvancedStatisicLogger implements IStatisticLogger { * * @param source i18n message source */ - public AdvancedStatisicLogger(IStatusMessenger source) { + public AdvancedStatisticLogger(IStatusMessenger source) { this.messageService = source; } @@ -59,6 +61,7 @@ public class AdvancedStatisicLogger implements IStatisticLogger { .spSector(protocolRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier()) .spCountry(protocolRequest.getServiceProviderConfiguration().getConfigurationValue( MsProxyServiceConstants.CONIG_PROPS_CONNECTOR_COUNTRYCODE)) + .citizenCountryCode("AT") .withMandates(selectMandateProcessType(authData)) .build()); writeEntryToLog(entry); @@ -108,9 +111,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); } @@ -136,7 +139,7 @@ public class AdvancedStatisicLogger implements IStatisticLogger { @JsonProperty("entityId") private final String idpEntityId; - @JsonProperty("success") + @JsonProperty("result") private SuccessEntry success; @JsonProperty("error") @@ -156,6 +159,9 @@ public class AdvancedStatisicLogger implements IStatisticLogger { @JsonProperty("spCountry") private final String spCountry; + @JsonProperty("citizenCountryCode") + private final String citizenCountryCode; + @JsonProperty("withMandates") private final MandateProcess withMandates; diff --git a/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/MultipleStatisticLogger.java b/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/MultipleStatisticLogger.java index bd771fb2..ccd81a27 100644 --- a/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/MultipleStatisticLogger.java +++ b/ms_specific_proxyservice/src/main/java/at/asitplus/eidas/specific/proxy/logger/MultipleStatisticLogger.java @@ -24,7 +24,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. */ @@ -32,7 +32,7 @@ public class MultipleStatisticLogger implements IStatisticLogger { internalLoggers = Collections.unmodifiableSet( Sets.newHashSet( new StatisticLogger(), - new AdvancedStatisicLogger(messageService))); + new AdvancedStatisticLogger(messageService))); } |