Logging
Track usage and errors in Expedia Group XAP SDK
Logging with Java
The Expedia Group XAP SDK for Java does not impose a logging framework on clients, and instead supports logging via the SLF4J interface. SLF4J provides an abstraction for various logging frameworks, allowing clients to plug in their desired implementation when building their projects.
Without a logging framework plugged in, the SDK (SLF4J) defaults to a no-operation, discarding all log requests with a single warning message.
Declaring project dependencies
Plug in a particular logging framework by declaring it as a project dependency. By design, SLF4J can use only one framework at a time, and it will emit a warning message if it finds multiple frameworks.
Simple logger
Java util logging
Logback
Log format
Logging frameworks support custom log formatting and layouts and including details such as the timestamp and the logger name at the origin of the logging event helps troubleshoot the SDK. In addition, log messages are annotated with the prefix ExpediaGroupSDK
against which they could be filtered out.
13:36:59.287 [DefaultDispatcher-worker-1] INFO c.e.s.c.c.c.ConfigurationCollector MDC= - ExpediaSDK: Successfully loaded [endpoint] from [runtime configuration]
Traceability
The SDK generates a unique transaction ID
for every API call, which is useful for troubleshooting issues by tracing requests on your end. The transactions IDs are logged at the DEBUG level.
In addition to the SDK-generated transaction ID
, the XAP APIs will generate and return their own transaction ID
in both the response headers as TxnId
and the response body as TransactionId
. This transaction ID
can be used to trace the request on the XAP side.