Jump to: navigation, search

Difference between revisions of "Jetty/Feature/Jetty Logging"

< Jetty‎ | Feature
m
m
Line 1: Line 1:
 
  {{Jetty Feature
 
  {{Jetty Feature
| introduction = (required)
+
| introduction =  
  
 
You can use Jetty with external logging frameworks, or you can use default Jetty logging.
 
You can use Jetty with external logging frameworks, or you can use default Jetty logging.

Revision as of 13:40, 25 October 2011



Introduction

You can use Jetty with external logging frameworks, or you can use default Jetty logging.

With any logging framework, all events have a name and a level. The name is a Fully Qualified Class Name (FQCN). The logging framework you choose determines the level. While the meaning of the levels is pretty much the same across logging frameworks, the descriptive identifiers for those levels are different.

Feature

(required)

Jetty Logging with External Frameworks

You can use a logging framework other than the default Jetty Log. You use SLF4J as a façade for a logging framework such as logback, java.util.logging, or log4j, and all logging events stream to that framework. The way you configure the framework determines what you see. If, for example, you want to ignore all events below WARN level, or turn on FINE/DEBUG level on org.eclipse.jetty.io.nio?, now you can.

The jetty-util module now houses org.eclipse.jetty.util.log.LOG, which is a Log façade for a logging implementation. By default, Jetty first looks for org.slf4j.impl.StaticLoggerBinder in the server classpath to configure an external logging framework. If it is not present, Jetty uses the internal logging mechanism, org.eclipse.jetty.util.log.StdErrLog.

For more information, see http://wiki.eclipse.org/Jetty#Javadoc_and_Source. For an example of a custom Logger, see http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/util/log/JavaUtilLog.html

Default Jetty Logging–org.eclipse.jetty.util.log.StdErrLog

The default Jetty log has one name for all logs, using a system property that turns on DEBUG and reports on predefined events that write to STDERR. You configure logging at startup.

Jetty logging includes some system properties that you can use to control filtering. For example, org.eclipse.jetty.util.log.stderr.DEBUG sets the level filter to DEBUG and higher, with the possible levels being IGNORE, DEBUG, INFO, and WARN. By default, Jetty filters from INFO and above, showing only INFO and WARN logs.

  • With StdErrLog you always see INFO and WARN logs. You can add DEBUG and/or IGNORE logs.
  • With the exception of org.eclipse.jetty.util.log.class these system properties take boolean values (true or false).

You set these system properties when you start Jetty.

The following system properties define Jetty Logging:

{