Version:
Only show these results:

Enable logging for the Nylas Java SDK

Logging

The SDK uses SLF4J for logging. Applications using the SDK can choose what logging framework to use.

Common choices are log4j, logback, java.util.logging. If the application doesn't specify any logging framework, then SLF4J will emit one warning and then be completely silent.

By default, the HTTP client is configured with the com.nylas.HttpLoggingInterceptor
which provides 3 loggers for HTTP requests that only log at DEBUG level.

  • com.nylas.http.Summary - Logs one line for each request and response.
    • Each request line contains: method, URI, and content size.
    • Each response contains: code, message, content, size, and duration.
  • com.nylas.http.Headers - logs the request and response HTTP headers (except Authorization value by default).
  • com.nylas.http.Body - logs request and response bodies (first 10 KB by default).

Enable or Disable Logging

Enabling or disabling those loggers is done with the logging framework being used. For example, if using log4j2 and with an XML configuration file, include this line to enable all three: <Logger name="com.nylas" level="DEBUG"/>

Configuring Authorization Header Logging

Configuring the logging of the HTTP Authorization header values and the body size limit can be done by using a NylasClient.Builder with a customized HttpLoggingInterceptor.