blob: b08af05becbccd832e1b5a98d710c4e86ed8ba22 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Default Logging with Jetty&#8217;s StdErrLog</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.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"><link rel="up" href="configuring-logging.html" title="Chapter&nbsp;11.&nbsp;Jetty Logging"><link rel="prev" href="configuring-logging.html" title="Chapter&nbsp;11.&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"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script>
hljs.initHighlightingOnLoad();
</script><link type="text/css" rel="stylesheet" href="css/font-awesome/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.3.28.v20191105</span></td><td style="width: 50%"></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&#8217;s StdErrLog</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="configuring-logging.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;11.&nbsp;Jetty Logging<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="configuring-jetty-request-logs.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></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 for sponsored feature development
</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&#8217;s StdErrLog</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="default-logging-with-stderrlog.html#stderrlog-configuration">StdErrLog Configuration</a></span></dt><dt><span class="section"><a href="default-logging-with-stderrlog.html#stderr-properties">The jetty-logging.properties File</a></span></dt><dt><span class="section"><a href="default-logging-with-stderrlog.html#deprecated-parameters">Deprecated Parameters</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="stderrlog-configuration"></a>StdErrLog Configuration</h3></div></div></div><p>If you do nothing to configure a separate logging framework, 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 <code class="literal">System.err</code>).</p><p>Simply use Jetty and <code class="literal">StdErrLog</code> based logging is output.</p><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 this feature via the command line:</p><pre 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"><code>[my-base]$ java -jar /opt/jetty/start.jar --module=logging</code></pre><p>You can also include the <code class="literal">--module=logging</code> command in your <code class="literal">${jetty.base}/start.ini</code>.</p><pre 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"><code>[my-base]$ java -jar /opt/jetty/start.jar --add-to-start=logging</code></pre><p>The default configuration for logging output will create a file <code class="literal">${jetty.logs}/yyyy_mm_dd.stderrout.log</code> which allows configuration of the output directory by setting the <code class="literal">jetty.logs</code> property.</p><p>For more advanced logging configurations, please consider use of a separate logging library.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="stderr-properties"></a>The jetty-logging.properties File</h3></div></div></div><p>The recommended way to configure <code class="literal">StdErrLog</code> is to create a <code class="literal">${jetty.home}/resources/jetty-logging.properties</code> file, specify the log implementation to <code class="literal">StdErrLog</code> and then setup logging levels.</p><pre 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"><code># 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</code></pre><p>There are a number of properties that can be defined in the configuration that will affect the behavior of <code class="literal">StdErrLog</code>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">&lt;name&gt;.LEVEL=&lt;level&gt;</code></span></dt><dd>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="literal">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="literal">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.</dd><dt><span class="term"><code class="literal">&lt;name&gt;.SOURCE=&lt;boolean&gt;</code></span></dt><dd>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.</dd><dt><span class="term"><code class="literal">&lt;name&gt;.STACKS=&lt;boolean&gt;</code></span></dt><dd>Named Logger specific, controls the display of stacktraces.
Name must be a fully qualified class name (this configurable does not support package name hierarchy).
Default is true.</dd><dt><span class="term"><code class="literal">org.eclipse.jetty.util.log.stderr.SOURCE=&lt;boolean&gt;</code></span></dt><dd>Special Global Configuration.
Attempts to print the Java source file name and line number from where the logging event originated.
Default is false.</dd><dt><span class="term"><code class="literal">org.eclipse.jetty.util.log.stderr.LONG=&lt;boolean&gt;</code></span></dt><dd><p class="simpara">Special Global Configuration.
When true, outputs logging events to <code class="literal">STDERR</code> using long form, fully qualified class names.
When false, uses abbreviated package names.
Default is false.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Example when set to false:</li></ul></div><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><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Example when set to true:</li></ul></div><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></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="deprecated-parameters"></a>Deprecated Parameters</h3></div></div></div><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 class="variablelist"><dt><span class="term"><code class="literal">org.eclipse.jetty.util.log.DEBUG</code></span></dt><dd><p class="simpara">Formerly used to enable DEBUG level logging on any logger used within Jetty (not just Jetty&#8217;s own logger).</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Replaced with using the logger implementation specific configuration and level filtering.</li></ul></div></dd><dt><span class="term"><code class="literal">org.eclipse.jetty.util.log.stderr.DEBUG</code></span></dt><dd><p class="simpara">Formerly used to enable DEBUG level logging on the internal Jetty <code class="literal">StdErrLog</code> implementation.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Replaced with level specific equivalent.
Example: <code class="literal">org.eclipse.jetty.LEVEL=DEBUG</code></li></ul></div></dd><dt><span class="term"><code class="literal">DEBUG</code></span></dt><dd><p class="simpara">Ancient debugging flag that turned on all debugging, even non-logging debugging.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Jetty no longer uses because many third party libraries employ this overly simple property name, which would generate far too much console output.</li></ul></div></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="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="configuring-logging.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="configuring-jetty-request-logs.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;11.&nbsp;Jetty Logging&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></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/eclipse/jetty.project">Contribute to this documentation at
<span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2019-11-05)</i></span></div></p></body></html>