Skip to main content
summaryrefslogtreecommitdiffstats
blob: b35b771812d205054b6f7ebf6e709cf143eea869 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Chapter&nbsp;19.&nbsp;Jetty Logging</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty : The Definitive Reference"><link rel="up" href="administration.html" title="Part&nbsp;III.&nbsp;Jetty Administration Guide"><link rel="prev" href="limit-load.html" title="Limiting Load"><link rel="next" href="default-logging-with-stderrlog.html" title="Default Logging with Jetty's StdErrLog"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><script type="text/javascript" src="js/shCore.js"></script><script type="text/javascript" src="js/shBrushJava.js"></script><script type="text/javascript" src="js/shBrushXml.js"></script><script type="text/javascript" src="js/shBrushBash.js"></script><script type="text/javascript" src="js/shBrushJScript.js"></script><script type="text/javascript" src="js/shBrushSql.js"></script><script type="text/javascript" src="js/shBrushProperties.js"></script><script type="text/javascript" src="js/shBrushPlain.js"></script><link type="text/css" rel="stylesheet" href="css/shCore.css"><link type="text/css" rel="stylesheet" href="css/shThemeEclipse.css"><link type="text/css" rel="stylesheet" href="css/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small">
            Version: 9.2.11-SNAPSHOT</span></td><td style="width: 50%"><script type="text/javascript">  (function() {
            var cx = '016459005284625897022:obd4lsai2ds';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
            '//www.google.com/cse/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
            })();
          </script><gcse:search></gcse:search></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&nbsp;19.&nbsp;Jetty Logging</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="limit-load.html"><i class="icon-chevron-left"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;III.&nbsp;Jetty Administration Guide<br><a accesskey="p" href="index.html"><i class="icon-home"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="default-logging-with-stderrlog.html">Next <i class="icon-chevron-right"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at
          <span class="website">www.webtide.com</span></a></h5><p>
 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 from 1 day to full product delivery
      </p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="configuring-logging"></a>Chapter&nbsp;19.&nbsp;Jetty Logging</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="configuring-logging.html#configuring-jetty-logging">Configuring Jetty Logging</a></span></dt><dt><span class="section"><a href="default-logging-with-stderrlog.html">Default Logging with Jetty's StdErrLog</a></span></dt><dt><span class="section"><a href="configuring-jetty-request-logs.html">Configuring Jetty Request Logs</a></span></dt><dt><span class="section"><a href="example-logging-log4j.html">Example: Logging with Apache Log4j</a></span></dt><dt><span class="section"><a href="example-logging-java-util-logging.html">Example: Logging with Java's java.util.logging via Slf4j</a></span></dt><dt><span class="section"><a href="example-logging-java-util-logging-native.html">Example: Logging with Java's java.util.logging via
  JavaUtilLog</a></span></dt><dt><span class="section"><a href="example-logging-logback.html">Example: Logging with Logback</a></span></dt><dt><span class="section"><a href="example-slf4j-multiple-loggers.html">Example: Capturing Multiple Logging Frameworks with Slf4j</a></span></dt><dt><span class="section"><a href="example-logging-logback-centralized.html">Example: Centralized Logging with Logback</a></span></dt><dt><span class="section"><a href="jetty-dump-tool.html">Jetty Dump Tool</a></span></dt></dl></div><p>This chapter discusses various options for configuring logging.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="configuring-jetty-logging"></a>Configuring Jetty Logging</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="configuring-logging.html#selecting-log-framework">Selecting the Log Framework</a></span></dt><dt><span class="section"><a href="configuring-logging.html#configuring-jetty-stderrlog">The jetty-logging.properties file</a></span></dt></dl></div><p>Jetty provides logging via its own
  <code class="code">org.eclipse.jetty.util.log.Logger</code> 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.</p><p>Jetty logging, however, has a slightly different set of levels that it
  uses internally:</p><div class="variablelist"><dl><dt><span class="term">WARN</span></dt><dd><p>For events serious enough to inform and log, but not
        fatal.</p></dd><dt><span class="term">INFO</span></dt><dd><p>Informational events.</p></dd><dt><span class="term">DEBUG</span></dt><dd><p>Debugging events (very noisy).</p></dd><dt><span class="term">IGNORE</span></dt><dd><p>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
        <span class="emphasis"><em>ignore</em></span> phrase somewhere in the logging.</p></dd></dl></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="icon-asterisk"></i> Note</h3><p>Jetty logging produces no FATAL or SEVERE events.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="selecting-log-framework"></a>Selecting the Log Framework</h3></div></div></div><p>Configure the Jetty logging layer via the
    <code class="code">org.eclipse.jetty.util.log.Log</code> class, following <a class="link" href="http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java" target="_top">these
    rules</a>.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Load Properties</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>First from a Classpath Resource called
            <code class="code">jetty-logging.properties</code> (if found).</p></li><li class="listitem"><p>Then from the <code class="code">System.getProperties()</code>.</p></li></ul></div></li><li class="listitem"><p>Determine the log implementation.</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>If property
            <code class="literal">org.eclipse.jetty.util.log.class</code> is defined,
            load the class it defines as the logger implementation from the
            server classpath.</p></li><li class="listitem"><p>If the class <code class="code">org.slf4j.Logger</code> exists in server
            classpath, the Jetty implementation becomes
            <code class="code">org.eclipse.jetty.util.log.Slf4jLog</code>.</p></li><li class="listitem"><p>If no logger implementation is specified, default to
            <code class="code">org.eclipse.jetty.util.log.StdErrLog</code>.</p></li></ul></div></li></ol></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="icon-asterisk"></i> Note</h3><p>You can create your own custom logging by providing an
      implementation of the <a class="link" href="http://download.eclipse.org/jetty/stable-9/apidocsorg/eclipse/jetty/util/log/Logger.html" target="_top">Jetty
      Logger API</a>. For an example of a custom logger, see <a class="link" href="http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-util/src/main/java/org/eclipse/jetty/util/log/JavaUtilLog.java" target="_top">JavaUtilLog.java</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuring-jetty-stderrlog"></a>The jetty-logging.properties file</h3></div></div></div><p>By default, the internal Jetty Logging discovery mechanism will load
    logging specific properties from a classpath resource called
    <code class="filename">jetty-logging.properties</code> and then initialize the
    Logging from a combination of properties found in that file, along with
    any System Properties.</p><p>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 <code class="literal">org.eclipse.jetty.util.log.class</code>
    property.</p><p>Examples for various logging frameworks can be found later in this
    documentation.</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Default Logging with <a class="link" href="default-logging-with-stderrlog.html" title="Default Logging with Jetty's StdErrLog">Jetty's
        StdErrLog</a></p></li><li class="listitem"><p>Using <a class="link" href="example-logging-log4j.html" title="Example: Logging with Apache Log4j">Log4j via
        Slf4jLog</a></p></li><li class="listitem"><p>Using <a class="link" href="example-logging-logback.html" title="Example: Logging with Logback">Logback via
        Slf4jLog</a></p></li><li class="listitem"><p>Using java.util.logging via Slf4jLog</p></li><li class="listitem"><p>Using java.util.logging via Jetty's JavaUtilLog</p></li><li class="listitem"><p>Capturing <a class="link" href="example-slf4j-multiple-loggers.html" title="Example: Capturing Multiple Logging Frameworks with Slf4j">Multiple Logging Frameworks
        via Slf4jLog</a></p></li><li class="listitem"><p><a class="link" href="example-logging-logback-centralized.html" title="Example: Centralized Logging with Logback">Centralized
        Logging with Logback and Sfl4jLog</a></p></li></ul></div></div></div></div><script type="text/javascript">
      SyntaxHighlighter.all()
    </script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="limit-load.html"><i class="icon-chevron-left"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="administration.html"><i class="icon-chevron-up"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="default-logging-with-stderrlog.html">Next <i class="icon-chevron-right"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Limiting Load&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="icon-home"></i> Home</a></td><td width="40%" align="right" valign="top">&nbsp;Default Logging with Jetty's StdErrLog</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout">
            See an error or something missing?
            <span class="callout"><a href="http://github.com/jetty-project/jetty-documentation">Contribute to this documentation at
                <span class="website"><i class="icon-github"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2015-05-18T01:01:37+00:00)</i></span></div></p><script xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1149868-7']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
    </script></body></html>

Back to the top