Bookmark and Share

Logging

CRest offer out-of-the-box support for the following frameworks:

CRest will automatically select the logging system available on the classpath.

To switch to another logging system you will need to provide an implementation of the Logger (or of the handy AbstractLogger) class and set the system property "org.codegist.common.log.class" to hold the custom logger implementation full qualified class name.

IO

To turn on CRest's HTTP requests/response logging, set your logging system to turn maximum logging level on the following loggers:

  • org.codegist.crest.io.Response for any incoming server responses
  • org.codegist.crest.io.Request for any outgoing requests

Please be aware that turning on these loggers can have a great impact on memory/performance as in order to log the response, CRest will dump it into memory, loosing the benefit of the streaming deserialization. As for the request, the impact on memory will be lighter but should be avoided on production setup.

Nota Bene: these logger names does not apply to the Android platform, see below.

Android

Android's logger uses TAGS to filter logging event.

CRest uses the accepted convention of logging event based on full qualified class name, which are likely to break the 23 characters limit imposed on Android's TAGs Strings (cf: LogCat javadoc).

For the sake of prodiving a predictable logging event filter name (which can't easily be obtained by simply truncrating the class name), CRest will log all it's events using the "CodeGist" default tag name. This can be changed by providig a custom TAG name in the system property "org.codegist.common.log.LogCatLogger.TAG".