Skip to main content
summaryrefslogtreecommitdiffstats
blob: 507af1062de3637da04fa94b57e0e0060662408b (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Default Logging with Jetty's StdErrLog</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, spdy, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty : The Definitive Reference"><link rel="up" href="configuring-logging.html" title="Chapter&nbsp;22.&nbsp;Jetty Logging"><link rel="prev" href="configuring-logging.html" title="Chapter&nbsp;22.&nbsp;Jetty Logging"><link rel="next" href="configuring-jetty-request-logs.html" title="Configuring Jetty Request Logs"><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.2-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">Default Logging with Jetty's StdErrLog</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="configuring-logging.html"><i class="icon-chevron-left"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;22.&nbsp;Jetty Logging<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="configuring-jetty-request-logs.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="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="default-logging-with-stderrlog"></a>Default Logging with Jetty's StdErrLog</h2></div></div></div><p>If you do nothing to configure your own logging framework, then Jetty
  will default to using an internal
  <code class="literal">org.eclipse.jetty.util.log.StdErrLog</code> implementation. This
  will output all logging events to STDERR (aka System.err).</p><p>Simply use Jetty and you get StdErrLog based logging output.</p><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a name="d0e14773"></a>Capturing Console Output to File</h3></div></div></div><p>Included in the Jetty distribution is a logging module that is
    capable of performing simple capturing of all STDOUT and STDERR output to
    a file that is rotated daily.</p><p>To enable on the command line:</p><div class="informalexample"><div class="screenexample"><pre class="screen">[my-base]$ java -jar /opt/jetty/start.jar <span class="bold"><strong>--module=logging</strong></span>
</pre></div></div><p>You can also include the <span class="command"><strong>--module=logging</strong></span> command
    in your <code class="filename">${jetty.base}/start.ini</code></p><div class="informalexample"><div class="screenexample"><pre class="screen">[my-base]$ java -jar /opt/jetty/start.jar <span class="bold"><strong>--add-to-start=logging</strong></span>
</pre></div></div><p>The default configuration for logging output will create a file
    <code class="filename">${jetty.logs}/yyyy_mm_dd.stderrout.log</code> which allows
    you to configure the output directory by setting the
    <code class="literal">jetty.logs</code> property to a path of your choice.</p><p>If you want a more advanced configuration of your logging output,
    consider using your logging library of choice. </p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a name="d0e14809"></a>Configuring StdErrLog</h3></div></div></div><p>The recommended way to configure StdErrLog is to create a
    <code class="filename">${jetty.home}/resources/jetty-logging.properties</code>
    file, specify the Log implementation to StdErrLog and then setup your
    logging levels.</p><p><script type="syntaxhighlighter" class="brush: properties;toolbar: false">
          <![CDATA[# Configure Jetty for StdErrLog Logging
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StrErrLog
# Overall Logging Level is INFO
org.eclipse.jetty.LEVEL=INFO
# Detail Logging for WebSocket
org.eclipse.jetty.websocket.LEVEL=DEBUG
]]>
        </script></p><p>There are a number of properties you can define in here that will
    affect the StdErrLog behavior.</p><div class="variablelist"><dl><dt><span class="term"><code class="code">&lt;name&gt;.LEVEL=&lt;level&gt;</code></span></dt><dd><p>Sets the logging level for all loggers within the
            <code class="literal">name</code> specified to the level, which can be (in
            increasing order of restriction) <code class="literal">ALL</code>,
            <code class="literal">DEBUG</code>, <code class="literal">INFO</code>,
            <code class="literal">WARN</code>, <code class="literal">OFF</code>. The name (or
            hierarchy) can be a specific fully qualified class or a package
            namespace, for example,
            <code class="code">org.eclipse.jetty.http.LEVEL=DEBUG</code> is a package
            namespace approach to turn all loggers in the Jetty HTTP package
            to DEBUG level, and
            <code class="code">org.eclipse.jetty.io.ChanelEndPoint.LEVEL=ALL</code> turns
            on all logging events for the specific class, including
            <code class="literal">DEBUG</code>, <code class="literal">INFO</code>,
            <code class="literal">WARN</code> (and even special internally ignored
            exception classes). If more than one system property specifies a
            logging level, the most specific one applies.</p></dd><dt><span class="term"><code class="code">&lt;name&gt;.SOURCE=&lt;boolean&gt;</code></span></dt><dd><p>Named Logger specific, attempts to print the Java source
            file name and line number from where the logging event originated.
            Name must be a fully qualified class name (this configurable does
            not support package name hierarchy). Default is false. Be aware
            that this is a slow operation and has an impact on
            performance.</p></dd><dt><span class="term"><code class="code">&lt;name&gt;.STACKS=&lt;boolean&gt;</code></span></dt><dd><p>Named Logger specific, controls the display of stacktraces.
            Name must be a fully qualified class name (this configurable does
            not support package name hierarchy). </p><p>Default is true.</p></dd><dt><span class="term"><code class="code">org.eclipse.jetty.util.log.stderr.SOURCE=&lt;boolean&gt;</code></span></dt><dd><p>Special Global Configuration. Attempts to print the Java
            source file name and line number from where the logging event
            originated. Default is false.</p></dd><dt><span class="term"><code class="code">org.eclipse.jetty.util.log.stderr.LONG=&lt;boolean&gt;</code></span></dt><dd><p>Special Global Configuration. When true, outputs logging
            events to STDERR using long form, fully qualified class names.
            When false, uses abbreviated package names. </p><p>Default is false.</p><p>Example when set to false:</p><div class="screenexample"><pre class="screen">2014-06-03 14:36:16.013:INFO:oejs.Server:main: jetty-9.2.0.v20140526
2014-06-03 14:36:16.028:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/opt/jetty/demo-base/webapps/] at interval 1
2014-06-03 14:36:16.051:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.MovedContextHandler@7d256e50{/oldContextPath,null,AVAILABLE}
2014-06-03 14:36:17.880:INFO:oejs.ServerConnector:main: Started ServerConnector@34f2d11a{HTTP/1.1}{0.0.0.0:8080}
2014-06-03 14:36:17.888:INFO:oejs.Server:main: Started @257ms
</pre></div><p>Example when set to true:</p><div class="screenexample"><pre class="screen">2014-06-03 14:38:19.019:INFO:org.eclipse.jetty.server.Server:main: jetty-9.2.0.v20140526
2014-06-03 14:38:19.032:INFO:org.eclipse.jetty.deploy.providers.ScanningAppProvider:main: Deployment monitor [file:/opt/jetty/demo-base/webapps/] at interval 1
2014-06-03 14:38:19.054:INFO:org.eclipse.jetty.server.handler.ContextHandler:main: Started o.e.j.s.h.MovedContextHandler@246d8660{/oldContextPath,null,AVAILABLE}
2014-06-03 14:38:20.715:INFO:org.eclipse.jetty.server.ServerConnector:main: Started ServerConnector@59f625be{HTTP/1.1}{0.0.0.0:8080}
2014-06-03 14:38:20.723:INFO:org.eclipse.jetty.server.Server:main: Started @243ms
</pre></div></dd></dl></div><p>Deprecated Parameters:</p><p>These parameters existed in prior versions of Jetty, and are no
    longer supported. They are included here for historical (and search
    engine) reasons.</p><div class="variablelist"><dl><dt><span class="term"><code class="code">org.eclipse.jetty.util.log.DEBUG</code></span></dt><dd><p>Formerly used to enable DEBUG level logging on any logger
            used within Jetty (not just Jetty's own logger).</p><p>Replaced with using the logger implementation specific
            configuration and level filtering.</p></dd><dt><span class="term"><code class="code">org.eclipse.jetty.util.log.stderr.DEBUG</code></span></dt><dd><p>Formerly used to enable DEBUG level logging on the internal
            Jetty StdErrLog implementation.</p><p>Replaced with level specific equivalent: example:
            <code class="code">org.eclipse.jetty.LEVEL=DEBUG</code></p></dd><dt><span class="term"><code class="code">DEBUG</code></span></dt><dd><p>Ancient debugging flag that turned on all debugging, even
            non-logging debugging.</p><p>Jetty no longer uses because many third party libraries
            employ this overly simple property name, which would generate far
            too much console output.</p></dd></dl></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="configuring-logging.html"><i class="icon-chevron-left"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="configuring-logging.html"><i class="icon-chevron-up"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="configuring-jetty-request-logs.html">Next <i class="icon-chevron-right"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;22.&nbsp;Jetty Logging&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;Configuring Jetty Request Logs</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: 2014-08-21T01:00:26-07: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