logging changes
This commit is contained in:
parent
5c422fb847
commit
6ed11c2cdd
|
@ -1,6 +1,7 @@
|
||||||
package org.opencdmp.service.deposit;
|
package org.opencdmp.service.deposit;
|
||||||
|
|
||||||
import gr.cite.tools.logging.LoggerService;
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import org.opencdmp.commonmodels.models.dmp.DmpModel;
|
import org.opencdmp.commonmodels.models.dmp.DmpModel;
|
||||||
import org.opencdmp.depositbase.repository.DepositClient;
|
import org.opencdmp.depositbase.repository.DepositClient;
|
||||||
import org.opencdmp.depositbase.repository.DepositConfiguration;
|
import org.opencdmp.depositbase.repository.DepositConfiguration;
|
||||||
|
@ -21,21 +22,25 @@ public class DepositClientImpl implements DepositClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String deposit(DmpModel dmpDepositModel, String repositoryAccessToken) throws Exception {
|
public String deposit(DmpModel dmpDepositModel, String repositoryAccessToken) throws Exception {
|
||||||
|
logger.debug(new MapLogEntry("deposit").And("dmpDepositModel", dmpDepositModel));
|
||||||
return this.depositClient.post().uri("", uriBuilder -> uriBuilder.queryParam("authToken", repositoryAccessToken).build()).bodyValue(dmpDepositModel).exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
|
return this.depositClient.post().uri("", uriBuilder -> uriBuilder.queryParam("authToken", repositoryAccessToken).build()).bodyValue(dmpDepositModel).exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String authenticate(String code) {
|
public String authenticate(String code) {
|
||||||
|
logger.debug(new MapLogEntry("code"));
|
||||||
return this.depositClient.get().uri("/authenticate/", uriBuilder -> uriBuilder.queryParam("authToken", code).build()).exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
|
return this.depositClient.get().uri("/authenticate/", uriBuilder -> uriBuilder.queryParam("authToken", code).build()).exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DepositConfiguration getConfiguration() {
|
public DepositConfiguration getConfiguration() {
|
||||||
|
logger.debug(new MapLogEntry("getConfiguration"));
|
||||||
return this.depositClient.get().uri("/configuration").exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(new ParameterizedTypeReference<DepositConfiguration>() {})).block();
|
return this.depositClient.get().uri("/configuration").exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(new ParameterizedTypeReference<DepositConfiguration>() {})).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLogo() {
|
public String getLogo() {
|
||||||
|
logger.debug(new MapLogEntry("getLogo"));
|
||||||
return this.depositClient.get().uri("/logo").exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
|
return this.depositClient.get().uri("/logo").exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyNotFoundException;
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
import gr.cite.tools.fieldset.FieldSet;
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import gr.cite.tools.validation.ValidatorFactory;
|
import gr.cite.tools.validation.ValidatorFactory;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
|
@ -55,7 +57,6 @@ import org.opencdmp.service.filetransformer.FileTransformerService;
|
||||||
import org.opencdmp.service.storage.StorageFileProperties;
|
import org.opencdmp.service.storage.StorageFileProperties;
|
||||||
import org.opencdmp.service.storage.StorageFileService;
|
import org.opencdmp.service.storage.StorageFileService;
|
||||||
import org.opencdmp.service.tenant.TenantProperties;
|
import org.opencdmp.service.tenant.TenantProperties;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
|
@ -84,7 +85,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DepositServiceImpl implements DepositService {
|
public class DepositServiceImpl implements DepositService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DepositServiceImpl.class);
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DepositServiceImpl.class));
|
||||||
|
|
||||||
private final DepositProperties depositProperties;
|
private final DepositProperties depositProperties;
|
||||||
private final Map<String, DepositClient> clients;
|
private final Map<String, DepositClient> clients;
|
||||||
|
@ -385,7 +386,7 @@ public class DepositServiceImpl implements DepositService {
|
||||||
|
|
||||||
private static ExchangeFilterFunction logRequest() {
|
private static ExchangeFilterFunction logRequest() {
|
||||||
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
||||||
logger.debug("Request: {} {}", clientRequest.method(), clientRequest.url());
|
logger.debug(new MapLogEntry("Request").And("method", clientRequest.method().toString()).And("url", clientRequest.url()));
|
||||||
return Mono.just(clientRequest);
|
return Mono.just(clientRequest);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -395,8 +396,7 @@ public class DepositServiceImpl implements DepositService {
|
||||||
if (response.statusCode().isError()) {
|
if (response.statusCode().isError()) {
|
||||||
return response.mutate().build().bodyToMono(String.class)
|
return response.mutate().build().bodyToMono(String.class)
|
||||||
.flatMap(body -> {
|
.flatMap(body -> {
|
||||||
logger.error("Request: {} {}", response.request().getMethod(), response.request().getURI());
|
logger.error(new MapLogEntry("Response").And("method", response.request().getMethod().toString()).And("url", response.request().getURI()).And("status", response.statusCode().toString()).And("body", body));
|
||||||
logger.error("Response: {} {}", response.statusCode(), body);
|
|
||||||
return Mono.just(response);
|
return Mono.just(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.jayway.jsonpath.DocumentContext;
|
||||||
import com.jayway.jsonpath.JsonPath;
|
import com.jayway.jsonpath.JsonPath;
|
||||||
import com.jayway.jsonpath.PathNotFoundException;
|
import com.jayway.jsonpath.PathNotFoundException;
|
||||||
import gr.cite.tools.exception.MyApplicationException;
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import net.minidev.json.JSONArray;
|
import net.minidev.json.JSONArray;
|
||||||
import org.opencdmp.commons.JsonHandlingService;
|
import org.opencdmp.commons.JsonHandlingService;
|
||||||
import org.opencdmp.commons.enums.ExternalFetcherSourceType;
|
import org.opencdmp.commons.enums.ExternalFetcherSourceType;
|
||||||
|
@ -17,7 +19,6 @@ import org.opencdmp.model.reference.Reference;
|
||||||
import org.opencdmp.service.externalfetcher.config.entities.*;
|
import org.opencdmp.service.externalfetcher.config.entities.*;
|
||||||
import org.opencdmp.service.externalfetcher.criteria.ExternalReferenceCriteria;
|
import org.opencdmp.service.externalfetcher.criteria.ExternalReferenceCriteria;
|
||||||
import org.opencdmp.service.externalfetcher.models.ExternalDataResult;
|
import org.opencdmp.service.externalfetcher.models.ExternalDataResult;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
|
@ -40,7 +41,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ExternalFetcherServiceImpl.class);
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ExternalFetcherServiceImpl.class));
|
||||||
|
|
||||||
private WebClient webClient;
|
private WebClient webClient;
|
||||||
private final ConventionService conventionService;
|
private final ConventionService conventionService;
|
||||||
|
@ -152,7 +153,8 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
case POST -> method =HttpMethod.POST;
|
case POST -> method =HttpMethod.POST;
|
||||||
default -> throw new MyApplicationException("unrecognized type " + authenticationConfiguration.getAuthMethod());
|
default -> throw new MyApplicationException("unrecognized type " + authenticationConfiguration.getAuthMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug(new MapLogEntry("Authentication").And("url", authenticationConfiguration.getAuthUrl()));
|
||||||
Map<String, Object> response = this.getWebClient().method(method).uri(authenticationConfiguration.getAuthUrl())
|
Map<String, Object> response = this.getWebClient().method(method).uri(authenticationConfiguration.getAuthUrl())
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.bodyValue(this.parseBodyString(authenticationConfiguration.getAuthRequestBody()))
|
.bodyValue(this.parseBodyString(authenticationConfiguration.getAuthRequestBody()))
|
||||||
|
@ -265,7 +267,10 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
case POST -> method =HttpMethod.POST;
|
case POST -> method =HttpMethod.POST;
|
||||||
default -> throw new MyApplicationException("unrecognized type " + apiSource.getHttpMethod());
|
default -> throw new MyApplicationException("unrecognized type " + apiSource.getHttpMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug(new MapLogEntry("Fetch data")
|
||||||
|
.And("url", urlString)
|
||||||
|
.And("body", jsonBody));
|
||||||
ResponseEntity<String> response = this.getWebClient().method(method).uri(urlString).headers(httpHeaders -> {
|
ResponseEntity<String> response = this.getWebClient().method(method).uri(urlString).headers(httpHeaders -> {
|
||||||
if (this.conventionService.isNullOrEmpty(apiSource.getContentType())) {
|
if (this.conventionService.isNullOrEmpty(apiSource.getContentType())) {
|
||||||
httpHeaders.setAccept(Collections.singletonList(MediaType.valueOf(apiSource.getContentType())));
|
httpHeaders.setAccept(Collections.singletonList(MediaType.valueOf(apiSource.getContentType())));
|
||||||
|
@ -382,7 +387,7 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
|
|
||||||
private static ExchangeFilterFunction logRequest() {
|
private static ExchangeFilterFunction logRequest() {
|
||||||
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
||||||
logger.debug("Request: {} {}", clientRequest.method(), clientRequest.url());
|
logger.debug(new MapLogEntry("Request").And("method", clientRequest.method().toString()).And("url", clientRequest.url()));
|
||||||
return Mono.just(clientRequest);
|
return Mono.just(clientRequest);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -392,8 +397,7 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
||||||
if (response.statusCode().isError()) {
|
if (response.statusCode().isError()) {
|
||||||
return response.mutate().build().bodyToMono(String.class)
|
return response.mutate().build().bodyToMono(String.class)
|
||||||
.flatMap(body -> {
|
.flatMap(body -> {
|
||||||
logger.error("Request: {} {}", response.request().getMethod(), response.request().getURI());
|
logger.error(new MapLogEntry("Response").And("method", response.request().getMethod().toString()).And("url", response.request().getURI()).And("status", response.statusCode().toString()).And("body", body));
|
||||||
logger.error("Response: {} {}", response.statusCode(), body);
|
|
||||||
return Mono.just(response);
|
return Mono.just(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
package org.opencdmp.service.filetransformer;
|
package org.opencdmp.service.filetransformer;
|
||||||
|
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
|
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
|
||||||
import org.opencdmp.commonmodels.models.description.DescriptionModel;
|
import org.opencdmp.commonmodels.models.description.DescriptionModel;
|
||||||
import org.opencdmp.commonmodels.models.dmp.DmpModel;
|
import org.opencdmp.commonmodels.models.dmp.DmpModel;
|
||||||
import org.opencdmp.filetransformerbase.interfaces.FileTransformerClient;
|
import org.opencdmp.filetransformerbase.interfaces.FileTransformerClient;
|
||||||
import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration;
|
import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
|
||||||
public class FileTransformerRepository implements FileTransformerClient {
|
public class FileTransformerRepository implements FileTransformerClient {
|
||||||
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(FileTransformerRepository.class));
|
||||||
|
|
||||||
private final WebClient transformerClient;
|
private final WebClient transformerClient;
|
||||||
|
|
||||||
|
@ -20,30 +24,35 @@ public class FileTransformerRepository implements FileTransformerClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileEnvelopeModel exportDmp(DmpModel dmpModel, String format) {
|
public FileEnvelopeModel exportDmp(DmpModel dmpModel, String format) {
|
||||||
|
logger.debug(new MapLogEntry("exportDmp").And("format", format).And("dmpModel", dmpModel));
|
||||||
return this.transformerClient.post().uri("/export/dmp", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(dmpModel)
|
return this.transformerClient.post().uri("/export/dmp", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(dmpModel)
|
||||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block();
|
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DmpModel importDmp(FileEnvelopeModel fileEnvelope) {
|
public DmpModel importDmp(FileEnvelopeModel fileEnvelope) {
|
||||||
|
logger.debug(new MapLogEntry("importDmp").And("fileEnvelope", fileEnvelope));
|
||||||
return this.transformerClient.post().uri("/import/dmp").bodyValue(fileEnvelope)
|
return this.transformerClient.post().uri("/import/dmp").bodyValue(fileEnvelope)
|
||||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DmpModel.class)).block();
|
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DmpModel.class)).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileEnvelopeModel exportDescription(DescriptionModel descriptionModel, String format) {
|
public FileEnvelopeModel exportDescription(DescriptionModel descriptionModel, String format) {
|
||||||
|
logger.debug(new MapLogEntry("exportDescription").And("format", format).And("descriptionModel", descriptionModel));
|
||||||
return this.transformerClient.post().uri("/export/description", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(descriptionModel)
|
return this.transformerClient.post().uri("/export/description", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(descriptionModel)
|
||||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block();
|
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DescriptionModel importDescription(FileEnvelopeModel fileEnvelope) {
|
public DescriptionModel importDescription(FileEnvelopeModel fileEnvelope) {
|
||||||
|
logger.debug(new MapLogEntry("importDescription").And("fileEnvelope", fileEnvelope));
|
||||||
return this.transformerClient.post().uri("/import/description").bodyValue(fileEnvelope)
|
return this.transformerClient.post().uri("/import/description").bodyValue(fileEnvelope)
|
||||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DescriptionModel.class)).block();
|
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DescriptionModel.class)).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileTransformerConfiguration getConfiguration() {
|
public FileTransformerConfiguration getConfiguration() {
|
||||||
|
logger.debug(new MapLogEntry("getConfiguration"));
|
||||||
return this.transformerClient.get().uri("/formats")
|
return this.transformerClient.get().uri("/formats")
|
||||||
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(new ParameterizedTypeReference<FileTransformerConfiguration>() {})).block();
|
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(new ParameterizedTypeReference<FileTransformerConfiguration>() {})).block();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
import gr.cite.tools.data.query.QueryFactory;
|
import gr.cite.tools.data.query.QueryFactory;
|
||||||
import gr.cite.tools.exception.MyNotFoundException;
|
import gr.cite.tools.exception.MyNotFoundException;
|
||||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import gr.cite.tools.logging.MapLogEntry;
|
||||||
import org.opencdmp.authorization.AuthorizationFlags;
|
import org.opencdmp.authorization.AuthorizationFlags;
|
||||||
import org.opencdmp.authorization.Permission;
|
import org.opencdmp.authorization.Permission;
|
||||||
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
|
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
|
||||||
|
@ -36,7 +38,6 @@ import org.opencdmp.query.TenantConfigurationQuery;
|
||||||
import org.opencdmp.service.encryption.EncryptionService;
|
import org.opencdmp.service.encryption.EncryptionService;
|
||||||
import org.opencdmp.service.storage.StorageFileService;
|
import org.opencdmp.service.storage.StorageFileService;
|
||||||
import org.opencdmp.service.tenant.TenantProperties;
|
import org.opencdmp.service.tenant.TenantProperties;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
|
@ -58,8 +59,7 @@ import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FileTransformerServiceImpl implements FileTransformerService {
|
public class FileTransformerServiceImpl implements FileTransformerService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(FileTransformerServiceImpl.class);
|
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(FileTransformerServiceImpl.class));
|
||||||
|
|
||||||
private final FileTransformerProperties fileTransformerProperties;
|
private final FileTransformerProperties fileTransformerProperties;
|
||||||
private final Map<String, FileTransformerRepository> clients;
|
private final Map<String, FileTransformerRepository> clients;
|
||||||
private final TokenExchangeCacheService tokenExchangeCacheService;
|
private final TokenExchangeCacheService tokenExchangeCacheService;
|
||||||
|
@ -260,11 +260,9 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static ExchangeFilterFunction logRequest() {
|
private static ExchangeFilterFunction logRequest() {
|
||||||
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
||||||
logger.debug("Request: {} {}", clientRequest.method(), clientRequest.url());
|
logger.debug(new MapLogEntry("Request").And("method", clientRequest.method().toString()).And("url", clientRequest.url()));
|
||||||
return Mono.just(clientRequest);
|
return Mono.just(clientRequest);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -274,8 +272,7 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
||||||
if (response.statusCode().isError()) {
|
if (response.statusCode().isError()) {
|
||||||
return response.mutate().build().bodyToMono(String.class)
|
return response.mutate().build().bodyToMono(String.class)
|
||||||
.flatMap(body -> {
|
.flatMap(body -> {
|
||||||
logger.error("Request: {} {}", response.request().getMethod(), response.request().getURI());
|
logger.error(new MapLogEntry("Response").And("method", response.request().getMethod().toString()).And("url", response.request().getURI()).And("status", response.statusCode().toString()).And("body", body));
|
||||||
logger.error("Response: {} {}", response.statusCode(), body);
|
|
||||||
return Mono.just(response);
|
return Mono.just(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue