How to set up logging in a Restlet in Jetty

To log messages in a Restlet (tested with 2.2.3) running in Jetty (tested with 8.1.11) you can use the default Java Logging mechanism i.e. java.util.logging.Logger.getLogger().

BUT the default log level is INFO.

To change the log level you need to

  1. create a log config properties file, called e.g.
  2. add -Djava.util.logging.config.file= with an absolute path to your config file (or relative to the Java workding directory, wherever that may be) to Jetty's VM options (JAVA_OPTIONS in

The config file (see official doc) should start with:

handlers = java.util.logging.ConsoleHandler
#  do not limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

Then you can start to change the log levels for all or just your classes' loggers:

#.level = ALL
de.mpiwg.itgroup.annotations.restlet.level = FINE

That should get your logging output into the default Jetty log file.