blob: c5e866150c51098c17815e663d5715c419eb568b [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> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>RollingFileAppender Class Reference</h1>Inheritance diagram for RollingFileAppender:<p><center><img src="classlog4cxx_1_1RollingFileAppender__inherit__graph.png" border="0" usemap="#RollingFileAppender__inherit__map" alt="Inheritance graph"></center>
<map name="RollingFileAppender__inherit__map">
<area href="classlog4cxx_1_1FileAppender.html" shape="rect" coords="50,392,144,416" alt="">
<area href="classlog4cxx_1_1WriterAppender.html" shape="rect" coords="45,317,149,341" alt="">
<area href="classlog4cxx_1_1AppenderSkeleton.html" shape="rect" coords="36,243,158,266" alt="">
<area href="classlog4cxx_1_1Appender.html" shape="rect" coords="13,168,85,192" alt="">
<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="73,19,124,43" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectImpl.html" shape="rect" coords="109,168,184,192" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for RollingFileAppender:<p><center><img src="classlog4cxx_1_1RollingFileAppender__coll__graph.png" border="0" usemap="#RollingFileAppender__coll__map" alt="Collaboration graph"></center>
<map name="RollingFileAppender__coll__map">
<area href="classlog4cxx_1_1FileAppender.html" shape="rect" coords="84,501,177,525" alt="">
<area href="classlog4cxx_1_1WriterAppender.html" shape="rect" coords="79,424,182,448" alt="">
<area href="classlog4cxx_1_1AppenderSkeleton.html" shape="rect" coords="69,346,192,370" alt="">
<area href="classlog4cxx_1_1Appender.html" shape="rect" coords="21,197,93,221" alt="">
<area href="classlog4cxx_1_1spi_1_1OptionHandler.html" shape="rect" coords="7,96,103,120" alt="">
<area href="classlog4cxx_1_1helpers_1_1Object.html" shape="rect" coords="80,19,131,43" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectImpl.html" shape="rect" coords="100,147,174,171" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html" shape="rect" coords="168,197,240,221" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classlog4cxx_1_1RollingFileAppender-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 Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#a0">RollingFileAppender</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#a1">RollingFileAppender</a> (const <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">LayoutPtr</a> &amp;<a class="el" href="classlog4cxx_1_1AppenderSkeleton.html#p0">layout</a>, const String &amp;<a class="el" href="classlog4cxx_1_1FileAppender.html#p1">fileName</a>, bool append)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#a2">RollingFileAppender</a> (const <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">LayoutPtr</a> &amp;<a class="el" href="classlog4cxx_1_1AppenderSkeleton.html#p0">layout</a>, const String &amp;<a class="el" href="classlog4cxx_1_1FileAppender.html#p1">fileName</a>)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#a4">getMaxBackupIndex</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#a5">getMaximumFileSize</a> () const </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_1RollingFileAppender.html#a6">rollOver</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_1RollingFileAppender.html#a7">setMaxBackupIndex</a> (int <a class="el" href="classlog4cxx_1_1RollingFileAppender.html#p1">maxBackupIndex</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_1RollingFileAppender.html#a8">setMaxFileSize</a> (const String &amp;value)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#a9">setOption</a> (const String &amp;option, const String &amp;value)</td></tr>
<tr><td colspan=2><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#b0">subAppend</a> (const <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">spi::LoggingEventPtr</a> &amp;event)</td></tr>
<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#p0">maxFileSize</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1RollingFileAppender.html#p1">maxBackupIndex</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="classlog4cxx_1_1RollingFileAppender.html">RollingFileAppender</a> extends <a class="el" href="classlog4cxx_1_1FileAppender.html">FileAppender</a> to backup the log files when they reach a certain size.
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="a0" doxytag="log4cxx::RollingFileAppender::RollingFileAppender" ></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_1RollingFileAppender.html">RollingFileAppender</a> </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></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
The default constructor simply calls its <a class="el" href="classlog4cxx_1_1FileAppender.html#a0">parents constructor</a>. </td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="log4cxx::RollingFileAppender::RollingFileAppender" ></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_1RollingFileAppender.html">RollingFileAppender</a> </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">LayoutPtr</a> &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>layout</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const String &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>fileName</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>bool&nbsp;</td>
<td class="mdname" nowrap> <em>append</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Instantiate a <a class="el" href="classlog4cxx_1_1RollingFileAppender.html">RollingFileAppender</a> and open the file designated by <code>filename</code>. The opened filename will become the ouput destination for this appender.<p>
If the <code>append</code> parameter is true, the file will be appended to. Otherwise, the file desginated by <code>filename</code> will be truncated before being opened. </td>
</tr>
</table>
<a class="anchor" name="a2" doxytag="log4cxx::RollingFileAppender::RollingFileAppender" ></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_1RollingFileAppender.html">RollingFileAppender</a> </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">LayoutPtr</a> &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>layout</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const String &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>fileName</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Instantiate a <a class="el" href="classlog4cxx_1_1FileAppender.html">FileAppender</a> and open the file designated by <code>filename</code>. The opened filename will become the output destination for this appender. <p>
The file will be appended to. </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a4" doxytag="log4cxx::RollingFileAppender::getMaxBackupIndex" ></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"> int getMaxBackupIndex </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> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Returns the value of the <b>MaxBackupIndex</b> option. </td>
</tr>
</table>
<a class="anchor" name="a5" doxytag="log4cxx::RollingFileAppender::getMaximumFileSize" ></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"> long getMaximumFileSize </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> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Get the maximum size that the output file is allowed to reach before being rolled over to backup files. </td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="log4cxx::RollingFileAppender::rollOver" ></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 rollOver </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></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Implements the usual roll over behaviour.<p>
If <code>MaxBackupIndex</code> is positive, then files {<code>File.1</code>, ..., <code>File.MaxBackupIndex -1</code>} are renamed to {<code>File.2</code>, ..., <code>File.MaxBackupIndex</code>}. Moreover, <code>File</code> is renamed <code>File.1</code> and closed. A new <code>File</code> is created to receive further log output.<p>
If <code>MaxBackupIndex</code> is equal to zero, then the <code>File</code> is truncated with no backup files created. </td>
</tr>
</table>
<a class="anchor" name="a7" doxytag="log4cxx::RollingFileAppender::setMaxBackupIndex" ></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 setMaxBackupIndex </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">int&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>maxBackupIndex</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Set the maximum number of backup files to keep around.<p>
The <b>MaxBackupIndex</b> option determines how many backup files are kept before the oldest is erased. This option takes a positive integer value. If set to zero, then there will be no backup files and the log file will be truncated when it reaches <code>MaxFileSize</code>. </td>
</tr>
</table>
<a class="anchor" name="a8" doxytag="log4cxx::RollingFileAppender::setMaxFileSize" ></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 setMaxFileSize </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const String &amp;&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>value</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.<p>
In configuration files, the <b>MaxFileSize</b> option takes an long integer in the range 0 - 2^63. You can specify the value with the suffixes "KB", "MB" or "GB" so that the integer is interpreted being expressed respectively in kilobytes, megabytes or gigabytes. For example, the value "10KB" will be interpreted as 10240. </td>
</tr>
</table>
<a class="anchor" name="a9" doxytag="log4cxx::RollingFileAppender::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> [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 OptionHandler instance. Some options may become active immediately whereas other may be activated only when <a class="el" href="classlog4cxx_1_1FileAppender.html#a9">activateOptions</a> is called.
<p>
Reimplemented from <a class="el" href="classlog4cxx_1_1FileAppender.html#a10">FileAppender</a>. </td>
</tr>
</table>
<a class="anchor" name="b0" doxytag="log4cxx::RollingFileAppender::subAppend" ></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 subAppend </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">spi::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><code> [protected, virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
This method differentiates <a class="el" href="classlog4cxx_1_1RollingFileAppender.html">RollingFileAppender</a> from its parent class.
<p>
Reimplemented from <a class="el" href="classlog4cxx_1_1WriterAppender.html#b2">WriterAppender</a>. </td>
</tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="p1" doxytag="log4cxx::RollingFileAppender::maxBackupIndex" ></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"> int <a class="el" href="classlog4cxx_1_1RollingFileAppender.html#p1">maxBackupIndex</a><code> [protected]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
There is one backup file by default. </td>
</tr>
</table>
<a class="anchor" name="p0" doxytag="log4cxx::RollingFileAppender::maxFileSize" ></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"> long <a class="el" href="classlog4cxx_1_1RollingFileAppender.html#p0">maxFileSize</a><code> [protected]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
The default maximum file size is 10MB. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li>rollingfileappender.h<li>rollingfileappender.cpp</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 -->