Open
Description
Hello author, I'm here again! This time I encountered NoSuchMethodError when enabling SDK log printing.
My project dependency version:
springboot 2.7.18
slf4j-api 1.7.36
logback-core 1.2.12
sdk configuration code:
@Bean
public PaypalServerSdkClient paypalServerSdkClient() {
PayPalProperties properties = paymentProperties.getPayPal();
Environment environment = Environment.SANDBOX;
if (!properties.getSandBox()) {
environment = Environment.PRODUCTION;
}
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder ->
logConfigBuilder
.body(true)
)
.responseConfig(logConfigBuilder ->
logConfigBuilder
.headers(true)
.body(true)
)
)
.httpClientConfig(configBuilder ->
configBuilder
.timeout(10)
)
.clientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(
properties.getClientId(),
properties.getClientSecret()
).build()
)
.environment(environment)
.build();
log.debug("PayPal支付SDK初始化完成");
log.debug("paypal config: {}", client);
return client;
}
Error code:
Caused by: java.lang.NoSuchMethodError: 'java.lang.String org.slf4j.helpers.MessageFormatter.basicArrayFormat(java.lang.String, java.lang.Object[])'
at io.apimatic.core.logger.ConsoleLogger.log(ConsoleLogger.java:30)
at io.apimatic.core.logger.SdkLogger.logRequest(SdkLogger.java:67)
at io.apimatic.core.ApiCall.execute(ApiCall.java:74)
at com.paypal.sdk.controllers.OAuthAuthorizationController.requestToken(OAuthAuthorizationController.java:50)
at com.paypal.sdk.authentication.ClientCredentialsAuthManager.fetchToken(ClientCredentialsAuthManager.java:164)
at com.paypal.sdk.authentication.ClientCredentialsAuthManager.fetchToken(ClientCredentialsAuthManager.java:179)
This error will occur if I configure loggingConfig and enable log printing. I tried to upgrade slf4j-api to 2.0.10 (from the current repository, I saw that your version is this), and then run it again without any problem, but the upgrade of slf4j-api from 1.7.x to 2.x is a bit big, which has a certain impact on my project (such as dependency version conflict, log cannot be output). I would like to ask for any better suggestions on this?
At present, I plan to turn off log printing.
Metadata
Metadata
Assignees
Labels
No labels