blob: 6771b3d7a9bbbe96e6125e5799b34dbf0c715849 [file] [log] [blame]
<html>
<head>
<title>
log4cxx - Documentation
</title>
<link href="../css/doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76">
<!-- START Header table -->
<table border="0" cellspacing="0" width="90%">
<!-- TOP IMAGE -->
<tr>
<td colspan="2">
<a href="http://logging.apache.org">
<img src="http://logging.apache.org/images/ls-logo.jpg" align="left" border="0"/>
</a>
</td>
</tr>
</table>
<!-- END Header table -->
<!-- START main table -->
<table id="main" border="0" width="90%" cellspacing="2" cellpadding="0">
<tr><td colspan="2">
<hr noshade="" size="1"/>
</td></tr>
<tr>
<!-- LEFT SIDE NAVIGATION -->
<td id="navbar" valign="top">
<!-- ============================================================ -->
<table id="navbar" border="0" cellspacing="0" cellpadding="0">
<tr >
<td class="navbarHeader" nowrap="true">
<strong>Apache</strong>
</td>
</tr>
<tr><td class="navbarItem"><small> <a href="http://www.apache.org">Apache Home</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="http://logging.apache.org/">Logging Services</a>
</small></td></tr>
<tr >
<td class="navbarHeader" nowrap="true">
<strong>log4cxx project</strong>
</td>
</tr>
<tr><td class="navbarItem"><small> <a href="../index.html">About</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../news.html">News</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../team.html">Team</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../manual/index.html">Documentation</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../performance.html">Performance</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../download.html">Download</a>
</small></td></tr>
</table>
</td>
<td id="mainContents" align="left" valign="top">
<hr>
<!-- Generated by Doxygen 1.3.5 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a></div>
<h1>Filter Class Reference</h1>Inheritance diagram for Filter:<p><center><img src="classlog4cxx_1_1spi_1_1Filter__inherit__graph.png" border="0" usemap="#Filter__inherit__map" alt="Inheritance graph"></center>
<map name="Filter__inherit__map">
<area href="classlog4cxx_1_1spi_1_1OptionHandler.html" shape="rect" coords="6,93,102,117" alt="">
<area href="classlog4cxx_1_1helpers_1_1Object.html" shape="rect" coords="84,18,134,42" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectImpl.html" shape="rect" coords="126,93,201,117" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for Filter:<p><center><img src="classlog4cxx_1_1spi_1_1Filter__coll__graph.png" border="0" usemap="#Filter__coll__map" alt="Collaboration graph"></center>
<map name="Filter__coll__map">
<area href="classlog4cxx_1_1spi_1_1OptionHandler.html" shape="rect" coords="6,96,102,120" alt="">
<area href="classlog4cxx_1_1helpers_1_1Object.html" shape="rect" coords="90,19,141,43" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectImpl.html" shape="rect" coords="126,96,201,120" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html" shape="rect" coords="225,96,297,120" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classlog4cxx_1_1spi_1_1Filter-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3">FilterDecision</a> { <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w0">DENY</a> = -1,
<a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w1">NEUTRAL</a> = 0,
<a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w2">ACCEPT</a> = 1
}</td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#a0">activateOptions</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#a1">setOption</a> (const String &amp;option, const String &amp;value)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3">FilterDecision</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#a2">decide</a> (const <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">LoggingEventPtr</a> &amp;event) const=0</td></tr>
<tr><td colspan=2><br><h2>Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">FilterPtr</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#o0">next</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Users should extend this class to implement customized logging event filtering. Note that <a class="el" href="classlog4cxx_1_1Logger.html">Logger</a> and <a class="el" href="classlog4cxx_1_1AppenderSkeleton.html">AppenderSkeleton</a>, the parent class of all standard appenders, have built-in filtering rules. It is suggested that you first use and understand the built-in rules before rushing to write your own custom filters.<p>
This abstract class assumes and also imposes that filters be organized in a linear chain. The <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#a2">decide(LoggingEvent)</a> method of each filter is called sequentially, in the order of their addition to the chain.<p>
The <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#a2">decide(LoggingEvent)</a> method must return one of the integer constants <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w0">DENY</a>, <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w1">NEUTRAL</a> or <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w2">ACCEPT</a>.<p>
If the value <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w0">DENY</a> is returned, then the log event is dropped immediately without consulting with the remaining filters.<p>
If the value <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w1">NEUTRAL</a> is returned, then the next filter in the chain is consulted. If there are no more filters in the chain, then the log event is logged. Thus, in the presence of no filters, the default behaviour is to log all logging events.<p>
If the value <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3w2">ACCEPT</a> is returned, then the log event is logged without consulting the remaining filters.<p>
The philosophy of log4cxx filters is largely inspired from the Linux ipchains.<p>
Note that filtering is only supported by the <a class="el" href="classlog4cxx_1_1xml_1_1DOMConfigurator.html">DOMConfigurator</a>.
<p>
<hr><h2>Member Enumeration Documentation</h2>
<a class="anchor" name="w3" doxytag="log4cxx::spi::Filter::FilterDecision" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> enum <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3">FilterDecision</a>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<dl compact><dt><b>Enumeration values: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em><a class="anchor" name="w3w0" doxytag="DENY" ></a>DENY</em>&nbsp;</td><td>
The log event must be dropped immediately without consulting with the remaining filters, if any, in the chain. </td></tr>
<tr><td valign=top><em><a class="anchor" name="w3w1" doxytag="NEUTRAL" ></a>NEUTRAL</em>&nbsp;</td><td>
This filter is neutral with respect to the log event. The remaining filters, if any, should be consulted for a final decision. </td></tr>
<tr><td valign=top><em><a class="anchor" name="w3w2" doxytag="ACCEPT" ></a>ACCEPT</em>&nbsp;</td><td>
The log event must be logged immediately without consulting with the remaining filters, if any, in the chain.</td></tr>
</table>
</dl>
</td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a0" doxytag="log4cxx::spi::Filter::activateOptions" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void activateOptions </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline, virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Usually filters options become active when set. We provide a<p>
default do-nothing implementation for convenience.
<p>
Implements <a class="el" href="classlog4cxx_1_1spi_1_1OptionHandler.html#a1">OptionHandler</a>. </td>
</tr>
</table>
<a class="anchor" name="a2" doxytag="log4cxx::spi::Filter::decide" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> virtual <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#w3">FilterDecision</a> decide </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">LoggingEventPtr</a> &amp;&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>event</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap> const<code> [pure virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
If the decision is <code>DENY</code>, then the event will be dropped. If the decision is <code>NEUTRAL</code>, then the next filter, if any, will be invoked. If the decision is ACCEPT then the event will be logged without consulting with other filters in the chain.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>event</em>&nbsp;</td><td>The <a class="el" href="classlog4cxx_1_1spi_1_1LoggingEvent.html">LoggingEvent</a> to decide upon. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The decision of the filter. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="log4cxx::spi::Filter::setOption" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void setOption </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const String &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>option</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const String &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>value</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"><code> [inline, virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Set <code>option</code> to <code>value</code>.<p>
The handling of each option depends on the <a class="el" href="classlog4cxx_1_1spi_1_1OptionHandler.html">OptionHandler</a> instance. Some options may become active immediately whereas other may be activated only when <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#a0">activateOptions</a> is called.
<p>
Implements <a class="el" href="classlog4cxx_1_1spi_1_1OptionHandler.html#a2">OptionHandler</a>. </td>
</tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="o0" doxytag="log4cxx::spi::Filter::next" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">FilterPtr</a> <a class="el" href="classlog4cxx_1_1spi_1_1Filter.html#o0">next</a>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Points to the next filter in the filter chain. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li>filter.h</ul>
</td>
</tr>
<!-- FOOTER -->
<tr><td colspan="2">
<hr noshade="" size="1"/>
</td></tr>
<tr><td colspan="2">
<div align="center"><font color="#525D76" size="-1"><em>
Copyright &#169; 1999-2004, Apache Software Foundation
</em></font></div>
</td></tr>
</table>
<!-- END main table -->
</body>
</html>
<!-- end the processing -->