blob: 14f81b6197484b0b0c9810f3144bf4a9c330e5df [file] [log] [blame]
<div class="docbook"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Chapter&#160;9.&#160;Runtime</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="Java-Broker-Security-Configuration-Encryption.html">Prev</a>&#160;</td><th align="center" width="60%">&#160;</th><td align="right" width="20%">&#160;<a accesskey="n" href="Java-Broker-Runtime-Disk-Space-Management.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Java-Broker-Runtime"></a>Chapter&#160;9.&#160;Runtime</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="Java-Broker-Runtime.html#Java-Broker-Runtime-Logging">9.1. Logging</a></span></dt><dd><dl><dt><span class="section"><a href="Java-Broker-Runtime.html#Java-Broker-Runtime-Logging-Concepts">9.1.1. Concepts</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime.html#Java-Broker-Runtime-Logging-Default-Configuration">9.1.2. Default Configuration</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime.html#Java-Broker-Runtime-Logging-Loggers">9.1.3. Loggers</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime.html#Java-Broker-Runtime-Logging-InclusionRules">9.1.4. Inclusion Rules</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime.html#Java-Broker-Runtime-Logging-Management">9.1.5. Logging Management</a></span></dt></dl></dd><dt><span class="section"><a href="Java-Broker-Runtime-Disk-Space-Management.html">9.2. Disk Space Management</a></span></dt><dd><dl><dt><span class="section"><a href="Java-Broker-Runtime-Disk-Space-Management.html#Java-Broker-Runtime-Disk-Space-Management-Producer-Flow-Control">9.2.1. Disk quota-based flow control</a></span></dt></dl></dd><dt><span class="section"><a href="Java-Broker-Runtime-Transaction-Timeout.html">9.3. Transaction Timeout</a></span></dt><dd><dl><dt><span class="section"><a href="Java-Broker-Runtime-Transaction-Timeout.html#Java-Broker-Runtime-Transaction-Timeout-GeneralInformation">9.3.1. General Information</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Transaction-Timeout.html#Java-Broker-Runtime-Transaction-Timeout-Purpose">9.3.2. Purpose</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Transaction-Timeout.html#Java-Broker-Runtime-Transaction-Timeout-Effect">9.3.3. Effect</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Transaction-Timeout.html#Java-Broker-Runtime-Transaction-Timeout-Configuration">9.3.4. Configuration</a></span></dt></dl></dd><dt><span class="section"><a href="Java-Broker-Runtime-Handling-Undeliverable-Messages.html">9.4. Handing Undeliverable Messages</a></span></dt><dd><dl><dt><span class="section"><a href="Java-Broker-Runtime-Handling-Undeliverable-Messages.html#Java-Broker-Runtime-Handling-Undeliverable-Messages-Introduction">9.4.1. Introduction</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Handling-Undeliverable-Messages.html#Java-Broker-Runtime-Handling-Undeliverable-Messages-Maximum-Delivery-Count">9.4.2. Maximum Delivery Count</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Handling-Undeliverable-Messages.html#Java-Broker-Runtime-Handling-Undeliverable-Messages-Dead-Letter-Queues">9.4.3. Alternate Binding</a></span></dt></dl></dd><dt><span class="section"><a href="Java-Broker-Runtime-Close-Connection-When-No-Route.html">9.5. Closing client connections on unroutable mandatory messages</a></span></dt><dd><dl><dt><span class="section"><a href="Java-Broker-Runtime-Close-Connection-When-No-Route.html#Java-Broker-Runtime-Close-Connection-When-No-Route-Summary">9.5.1. Summary</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Close-Connection-When-No-Route.html#Java-Broker-Runtime-Close-Connection-When-No-Route-Configuration">9.5.2. Configuring
<span class="emphasis"><em>closeWhenNoRoute</em></span>
</a></span></dt></dl></dd><dt><span class="section"><a href="Java-Broker-Runtime-Flow-To-Disk.html">9.6. Flow to Disk</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Consumers.html">9.7. Consumers</a></span></dt><dd><dl><dt><span class="section"><a href="Java-Broker-Runtime-Consumers.html#Java-Broker-Runtime-Consumers-Prioirty">9.7.1. Priority</a></span></dt></dl></dd><dt><span class="section"><a href="Java-Broker-Runtime-Background-Recovery.html">9.8. Background Recovery</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Message-Compression.html">9.9. Message Compression</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Connection-Limit.html">9.10. Connection Limits</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Memory.html">9.11. Memory</a></span></dt><dd><dl><dt><span class="section"><a href="Java-Broker-Runtime-Memory.html#Java-Broker-Runtime-Memory-Introduction">9.11.1. Introduction</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Memory.html#Java-Broker-Runtime-Memory-Types">9.11.2. Types of Memory</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Memory.html#Java-Broker-Runtime-Memory-Usage">9.11.3. Memory Usage in the Broker</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Memory.html#Java-Broker-Runtime-Memory-Low-Memory">9.11.4. Low Memory Conditions</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Memory.html#Java-Broker-Runtime-Memory-Defaults">9.11.5. Defaults</a></span></dt><dt><span class="section"><a href="Java-Broker-Runtime-Memory.html#Java-Broker-Runtime-Memory-Tuning">9.11.6. Memory Tuning the Broker</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Java-Broker-Runtime-Logging"></a>9.1.&#160;Logging</h2></div></div></div><p>This section describes the flexible logging capabilities of the Apache Qpid Broker-J.</p><p>
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The Broker is capable of sending logging events to a variety of destinations including
plain files, remote syslog daemons, and an in-memory buffer (viewable from Management).
The system is also open for extension meaning it is possible to produce a plugin to log to
a bespoke destination.</p></li><li class="listitem"><p>Logging can be dynamically configured at runtime. For instance, it is possible to
temporarily increase the logging verbosity of the system whilst a problem is investigated
and then revert later, all without the need to restart the Broker.</p></li><li class="listitem"><p>Virtualhosts can be configured to generate their own separate log, and the Broker is
capable of generating a log either inclusive or exclusive of virtualhost events.</p></li><li class="listitem"><p>Logs are accessible over Management, removing the need for those operating the Broker
to have shell level access.</p></li></ul></div><p>
</p><p>In the remainder of this section you will first find a description of the concepts used in
the logging subsystem. Next, you find a description of the default configuration. The section
then concludes with a in-depth description of the loggers themselves and how they may be
configured.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Java-Broker-Runtime-Logging-Concepts"></a>9.1.1.&#160;Concepts</h3></div></div></div><p>The logging subsystem uses two concepts:</p><p>
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>A <span class="emphasis"><em>Logger</em></span> is responsible for production of a log. The Broker
ships a variety of loggers, for instance, a file logger, which is capable of writing a
log file to the file system, a Syslog Logger capable of writing to a remote syslog
daemon and console logger capable of writing to stdout or stderr.</p><p>Loggers are attached at two points within the Broker Model; the Broker itself and
the virtualhosts. Loggers attached at the Broker can capture log events for the system
as a whole, or can exclude events related to virtualhosts.</p><p>Loggers attached to a virtualhost capture log events relating to that virtualhost
only.</p><p>The Broker and virtualhosts can have zero or more Loggers. If no loggers are
configured, no logging is generated at all.</p></li><li class="listitem"><p><span class="emphasis"><em>Inclusion rules</em></span> govern what appears within a log. Inclusion
rules are associated with Loggers. This means it is possible for different Loggers to
have different contents.</p><p>A Logger with no inclusion rules will produce an empty log.</p></li></ul></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Java-Broker-Runtime-Logging-Default-Configuration"></a>9.1.2.&#160;Default Configuration</h3></div></div></div><p>The default configuration is designed to be suitable for use without change in small
production environments. It has the following characteristics:</p><p>
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The Broker generates a single log file <code class="literal">qpid.log</code>. This logfile is
rolled automatically when the file reaches 100MB. A maximum history of one file is
retained. On restart the the log will be appended to.</p><p>The log contains: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>All operational logging events. See <a class="xref" href="Java-Broker-Appendix-Operation-Logging.html" title="Appendix&#160;C.&#160;Operational Logging">Appendix&#160;C, <em>Operational Logging</em></a>.</p></li><li class="listitem"><p>Log events from Qpid itself deemed informational or
higher.</p></li><li class="listitem"><p>Log events from Qpid's dependencies (such as Derby or Jetty) that are
deemed warning or higher.</p></li></ul></div><p>
</p><p>The default location for the log file is
<code class="literal">${QPID_WORK}/log/qpid.log</code>.</p></li><li class="listitem"><p>The Broker also caches the last 4096 log events in a memory cache. By default, the
memory logger logs the same things the file logger does.</p></li></ul></div><p>
</p><p>The configuration can be customised at runtime using Management. This makes it possible to
investigate unusual conditions <span class="emphasis"><em>without</em></span> the need to restart the Broker.
For instance, you may alter the logging level so that a verbose log is produced whilst an
investigation is in progress and revert the setting later, all without the need to restart the
Broker.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Java-Broker-Runtime-Logging-Loggers"></a>9.1.3.&#160;Loggers</h3></div></div></div><p>Loggers are responsible for the writing of a log. The log includes log events that match a
Logger's inclusion rules.</p><p>Loggers are associated with either the Broker or a virtualhost. Virtualhost loggers write
only log events related to that virtualhost. Broker Loggers write log events from the Broker
as a whole. Optionally a Broker Logger can be configured to exclude log events coming from
virtualhosts. These abilities can be usefully exploited together in managed service scenarios
to produce separate logs for separate user groups.</p><p>Loggers can be added or removed at runtime, without restarting the Broker. However changes
to a Logger's configuration such as filenames and rolling options don't take effect until the
next restart. Changes to a Logger's inclusion rules take effect immediately.</p><p>All loggers allow the log event layout to be customised. Loggers understand <a class="link" href="http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout" target="_top"> Logback Classic
Pattern Layouts</a>. </p><p>The following sections describes each Logger implementation in detail.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="Java-Broker-Runtime-Logging-Loggers-FileLogger"></a>9.1.3.1.&#160;FileLogger</h4></div></div></div><p>A <span class="emphasis"><em>FileLogger</em></span> - writes a log file to the filesystem. The name and
location of the log file, the rolling configuration, and compression options can be
configured.</p><p>The <span class="emphasis"><em>roll daily</em></span> option, if enabled, will cause the log file will be
rolled at midnight local time. The rolled over file will have a suffix in the form
<code class="literal">yyyy-mm-dd</code>. In roll daily mode, <span class="emphasis"><em>maximum number of rolled
files</em></span> controls the maximum number of <span class="emphasis"><em>days</em></span> to be retained.
Older files will be deleted.</p><p>The <span class="emphasis"><em>maximum file size</em></span> option limits the size of any one log file.
Once a log file reaches the given size, it will be rolled. The rolled over file will have
the numeric suffix, beginning at <code class="literal">1</code>. If the log file rolls again, first
the existing file with the suffix <code class="literal">.1</code> is renamed to <code class="literal">.2</code>
and so forth. If roll daily is not in use, <span class="emphasis"><em>maximum number of rolled
files</em></span> governs the number of rolled <span class="emphasis"><em>files</em></span> that will be
retained.</p><p><span class="emphasis"><em>Roll on restart</em></span> governs whether the log file is rolled when the
Broker is restarted. If not ticked, the Broker will append to the existing log file until it
needs to be rolled.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="Java-Broker-Runtime-Logging-Loggers-ConsoleLogger"></a>9.1.3.2.&#160;ConsoleLogger</h4></div></div></div><p><span class="emphasis"><em>ConsoleLogger</em></span> - writes a log file standard out or standard
error.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="Java-Broker-Runtime-Logging-Loggers-SyslogLogger"></a>9.1.3.3.&#160;SyslogLogger</h4></div></div></div><p><span class="emphasis"><em>SyslogLogger</em></span> - writes a log file to a syslog daemon using the
<code class="literal">USER</code> facility. The hostname and port number of the syslog daemon can be
configured.</p><p>Log entries can be prefixed with a string. This string defaults to include the word
<code class="literal">Qpid</code> and the name of the Broker or virtualhost. This serves to
distinguish the logging generated by this Qpid instance, from other Qpid instances, or other
applications using the <code class="literal">USER</code>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="Java-Broker-Runtime-Logging-Loggers-MemoryLogger"></a>9.1.3.4.&#160;MemoryLogger</h4></div></div></div><p><span class="emphasis"><em>MemoryLogger</em></span> - writes a log file to a circular in-memory buffer. By
default the circular buffer holds the last 4096 log events. The contents of the buffer can
be viewed via Management. See <a class="xref" href="Java-Broker-Runtime.html#Java-Broker-Runtime-Logging-Management-MemoryLogger" title="Figure&#160;9.3.&#160;Viewing a memory logger">Figure&#160;9.3, &#8220;Viewing a memory logger&#8221;</a></p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Java-Broker-Runtime-Logging-InclusionRules"></a>9.1.4.&#160;Inclusion Rules</h3></div></div></div><p>A <span class="emphasis"><em>Logger</em></span> has one or more <span class="emphasis"><em>inclusion rules</em></span>. These
govern what appears in the log. A Logger with no inclusion rules will log nothing.</p><p>Inclusion rules can be added, removed or changed at runtime. Changes take place
immediately.</p><p>
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The <span class="emphasis"><em>Name And Level</em></span> inclusion rule accepts log events that match
a given <span class="emphasis"><em>log event source name</em></span> and have a level that equals or
exceeds the specified value.</p><p>The log event source name refers to the fully qualified class name from which the
event originates. These names permit a trailing wild card <code class="literal">.*</code>. For
instance a source name of <code class="literal">org.apache.qpid.*</code> will match all events
from classes in the package <code class="literal">org.apache.qpid</code> and any sub packages
beneath.</p><p>The <span class="emphasis"><em>Level</em></span> governs the level of the events that will be included
in the log. It may take one of the following values: ERROR, WARN, INFO, DEBUG, TRACE
where ERROR is considered the highest and TRACE the lowest. In addition, there are two
special values: OFF and ALL, the former excludes all log events whereas the latter will
include everything. When considering whether a logging event should be included in the
log, the logging event must have a level that matches that of the inclusion rule or be
higher, otherwise the log event will not appear in the log.</p></li></ul></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Java-Broker-Runtime-Logging-Management"></a>9.1.5.&#160;Logging Management</h3></div></div></div><p>The logging subsystem can be completely managed from the Web Management Console or the
REST API. You can: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Add, remove, or change the configuration of Loggers.</p></li><li class="listitem"><p>Add, remove, or change the Inclusion Rules.</p></li><li class="listitem"><p>For FileLoggers, download the log file and rolled log files associated with
the Logger.</p></li><li class="listitem"><p>For MemoryLoggers, view the last <code class="literal">n</code> log
events</p></li></ul></div><p>
</p><p> The figure that follows shows a FileLogger. The attributes area shows the configuration
of the Logger. The inclusion rule table shows the rules that are associated with the Logger.
The area towards the bottom of the tab allows the log files to be downloaded to the browser.
</p><div class="figure"><a id="Java-Broker-Runtime-Logging-Management-FileLogger"></a><p class="title"><strong>Figure&#160;9.1.&#160;Viewing a file logger</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" style="cellpadding: 0; cellspacing: 0;" summary="manufactured viewport for HTML img" width="900"><tr><td><img alt="Viewing a file logger" src="images/Management-Web-Logging-FileLogger.png" width="900" /></td></tr></table></div></div></div><p><br class="figure-break" />
</p><p> The figure below shows the editing of the level of an inclusion rule. </p><div class="figure"><a id="Java-Broker-Runtime-Logging-Management-InclusionRule"></a><p class="title"><strong>Figure&#160;9.2.&#160;Editing an inclusion rule</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" style="cellpadding: 0; cellspacing: 0;" summary="manufactured viewport for HTML img" width="900"><tr><td><img alt="Editing an inclusion rule" src="images/Management-Web-Logging-InclusionRule.png" width="900" /></td></tr></table></div></div></div><p><br class="figure-break" />
</p><p> The figure below shows a Memory Logger. Note that the Memory Logger provides access to
the cached message via the viewer towards the bottom on the tab. </p><div class="figure"><a id="Java-Broker-Runtime-Logging-Management-MemoryLogger"></a><p class="title"><strong>Figure&#160;9.3.&#160;Viewing a memory logger</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" style="cellpadding: 0; cellspacing: 0;" summary="manufactured viewport for HTML img" width="900"><tr><td><img alt="Viewing a memory logger" src="images/Management-Web-Logging-MemoryLogger.png" width="900" /></td></tr></table></div></div></div><p><br class="figure-break" />
</p></div></div></div><div class="navfooter"><hr /><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="Java-Broker-Security-Configuration-Encryption.html">Prev</a>&#160;</td><td align="center" width="20%">&#160;</td><td align="right" width="40%">&#160;<a accesskey="n" href="Java-Broker-Runtime-Disk-Space-Management.html">Next</a></td></tr><tr><td align="left" valign="top" width="40%">8.4.&#160;Configuration Encryption&#160;</td><td align="center" width="20%"><a accesskey="h" href="Apache-Qpid-Broker-J-Book.html">Home</a></td><td align="right" valign="top" width="40%">&#160;9.2.&#160;Disk Space Management</td></tr></table></div></div>