Edit in GitHubLog an issue

Logger

Description#

When initializing the SDK, there are several options on the ClientConfig object, which can be set to log requests.

OptionDescription
logRequestsLogs whole request body as well as response body.
logRequestStatusLogs request's url, status along with response time.

Target Java SDK uses slf4j logging. You need to provide your implementation of logger such as java.util.logging, logback, and log4j. Refer to http://www.slf4j.org/manual.html for more information. All logs will be printed in debug.

Example#

Add the slf4j dependency.

Copied to your clipboard
compile 'org.slf4j:slf4j-simple:2.0.0-alpha0'

Enable the DEBUG logs based on your implementation, and mark the request logging flags.

Copied to your clipboard
1System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
2ClientConfig config = ClientConfig.builder()
3 .client("acmeclient")
4 .organizationId("1234567890@AdobeOrg")
5 .logRequests(true)
6 .logRequestStatus(true)
7 .build();
8
9TargetClient targetClient = TargetClient.create(config);

You should see requests, responses, and response times being printed in the console.

Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.