Version: 9.4.7.v20170914 |

Chapter 11. Jetty Logging
Previous | Part III. Jetty Administration Guide Home | Next

##### Contact the core Jetty developers at www.webtide.com

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

## Chapter 11. Jetty Logging

This chapter discusses various options for configuring logging.

## Configuring Jetty Logging

Jetty provides logging via its own `org.eclipse.jetty.util.log.Logger` layer, and does not natively use any existing Java logging framework. All logging events, produced via the Jetty logging layer, have a name, a level, and a message. The name is a FQCN (fully qualified class name) similar to how all existing Java logging frameworks operate.

Jetty logging, however, has a slightly different set of levels that it uses internally:

WARN
  For events serious enough to inform and log, but not fatal.
INFO
  Informational events.
DEBUG
  Debugging events (very noisy).
IGNORE
  Exception events that you can safely ignore, but useful for some people. You might see this level as DEBUG under some Java logging framework configurations, where it retains the ignore phrase somewhere in the logging.

> ### Note

> Jetty logging produces no FATAL or SEVERE events.

### Selecting the Log Framework

Configure the Jetty logging layer via the `org.eclipse.jetty.util.log.Log` class, following these rules.

1. Load Properties

   - First from a Classpath Resource called `jetty-logging.properties` (if found).
   - Then from the `System.getProperties()`.

2. Determine the log implementation.

   - If property `org.eclipse.jetty.util.log.class` is defined, load the class it defines as the logger implementation from the server `classpath`.
   - If the class `org.slf4j.Logger` exists in server classpath, the Jetty implementation becomes `org.eclipse.jetty.util.log.Slf4jLog`.
   - If no logger implementation is specified, default to `org.eclipse.jetty.util.log.StdErrLog`.

> ### Note

> You can create your own custom logging by providing an implementation of the Jetty Logger API. For an example of a custom logger, see JavaUtilLog.java.

### The jetty-logging.properties file

By default, the internal Jetty Logging discovery mechanism will load logging specific properties from a classpath resource called `jetty-logging.properties` and then initialize the Logging from a combination of properties found in that file, along with any System Properties. A typical jetty-logging.properties file will include at least the declaration of which logging implementation you want to use by defining a value for the `org.eclipse.jetty.util.log.class` property.

Examples for various logging frameworks can be found later in this documentation.

- Default Logging with Jetty’s StdErrLog
- Using Log4j or Log4j2 via SLF4J
- Using Logback via SLF4J
- Using Java Util Logging via SLF4J
- Using Java Commons Logging via SLF4J
- Centralized Logging with Logback and Sfl4jLog

Previous | Top | Next
Use Cases | Home | Default Logging with Jetty’s StdErrLog

See an error or something missing? Contribute to this documentation at Github!(Generated: 2017-09-14)