logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r569257 [15/18] - in /logging/site/trunk/docs/log4j/companions/extras: ./ apidocs/ apidocs/org/apache/log4j/ apidocs/org/apache/log4j/class-use/ apidocs/org/apache/log4j/extras/ apidocs/org/apache/log4j/extras/class-use/ apidocs/org/apache/...
Date Fri, 24 Aug 2007 05:43:56 GMT
Modified: logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/FixedWindowRollingPolicy.html
URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/FixedWindowRollingPolicy.html?rev=569257&r1=569256&r2=569257&view=diff
==============================================================================
--- logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/FixedWindowRollingPolicy.html (original)
+++ logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/FixedWindowRollingPolicy.html Thu Aug 23 22:43:39 2007
@@ -68,268 +68,267 @@
 <a name="59" href="#59">59</a>  <em> *</em>
 <a name="60" href="#60">60</a>  <em> *</em>
 <a name="61" href="#61">61</a>  <em> * @author Ceki G&amp;uuml;lc&amp;uuml;</em>
-<a name="62" href="#62">62</a>  <em> * @since 1.3</em>
-<a name="63" href="#63">63</a>  <em> * */</em>
-<a name="64" href="#64">64</a>  <strong>public</strong> <strong>final</strong> <strong>class</strong> <a href="../../../../org/apache/log4j/rolling/FixedWindowRollingPolicy.html">FixedWindowRollingPolicy</a> <strong>extends</strong> <a href="../../../../org/apache/log4j/rolling/RollingPolicyBase.html">RollingPolicyBase</a> {
-<a name="65" href="#65">65</a>  
-<a name="66" href="#66">66</a>    <em>/**<em>*</em></em>
-<a name="67" href="#67">67</a>  <em>   * It's almost always a bad idea to have a large window size, say over 12.</em>
-<a name="68" href="#68">68</a>  <em>   */</em>
-<a name="69" href="#69">69</a>    <strong>private</strong> <strong>static</strong> <strong>final</strong> <strong>int</strong> MAX_WINDOW_SIZE = 12;
-<a name="70" href="#70">70</a>  
-<a name="71" href="#71">71</a>    <em>/**<em>*</em></em>
-<a name="72" href="#72">72</a>  <em>   * Index for oldest retained log file.</em>
-<a name="73" href="#73">73</a>  <em>   */</em>
-<a name="74" href="#74">74</a>    <strong>private</strong> <strong>int</strong> maxIndex;
-<a name="75" href="#75">75</a>  
-<a name="76" href="#76">76</a>    <em>/**<em>*</em></em>
-<a name="77" href="#77">77</a>  <em>   * Index for most recent log file.</em>
-<a name="78" href="#78">78</a>  <em>   */</em>
-<a name="79" href="#79">79</a>    <strong>private</strong> <strong>int</strong> minIndex;
-<a name="80" href="#80">80</a>  
-<a name="81" href="#81">81</a>    <em>/**<em>*</em></em>
-<a name="82" href="#82">82</a>  <em>   *  if true, then an explicit name for the active file was</em>
-<a name="83" href="#83">83</a>  <em>   * specified using RollingFileAppender.file or the</em>
-<a name="84" href="#84">84</a>  <em>   * redundent RollingPolicyBase.setActiveFile</em>
-<a name="85" href="#85">85</a>  <em>   */</em>
-<a name="86" href="#86">86</a>    <strong>private</strong> <strong>boolean</strong> explicitActiveFile;
-<a name="87" href="#87">87</a>  
-<a name="88" href="#88">88</a>    <em>/**<em>*</em></em>
-<a name="89" href="#89">89</a>  <em>   * Constructs a new instance.</em>
-<a name="90" href="#90">90</a>  <em>   */</em>
-<a name="91" href="#91">91</a>    <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/FixedWindowRollingPolicy.html">FixedWindowRollingPolicy</a>() {
-<a name="92" href="#92">92</a>      minIndex = 1;
-<a name="93" href="#93">93</a>      maxIndex = 7;
-<a name="94" href="#94">94</a>    }
-<a name="95" href="#95">95</a>  
-<a name="96" href="#96">96</a>    <em>/**<em>*</em></em>
-<a name="97" href="#97">97</a>  <em>   * {@inheritDoc}</em>
-<a name="98" href="#98">98</a>  <em>   */</em>
-<a name="99" href="#99">99</a>    <strong>public</strong> <strong>void</strong> activateOptions() {
-<a name="100" href="#100">100</a>     <strong>super</strong>.activateOptions();
-<a name="101" href="#101">101</a> 
-<a name="102" href="#102">102</a>     <strong>if</strong> (maxIndex &lt; minIndex) {
-<a name="103" href="#103">103</a>       LogLog.warn(
-<a name="104" href="#104">104</a>         <span class="string">"MaxIndex ("</span> + maxIndex + <span class="string">") cannot be smaller than MinIndex ("</span>
-<a name="105" href="#105">105</a>         + minIndex + <span class="string">")."</span>);
-<a name="106" href="#106">106</a>       LogLog.warn(<span class="string">"Setting maxIndex to equal minIndex."</span>);
-<a name="107" href="#107">107</a>       maxIndex = minIndex;
-<a name="108" href="#108">108</a>     }
-<a name="109" href="#109">109</a> 
-<a name="110" href="#110">110</a>     <strong>if</strong> ((maxIndex - minIndex) > MAX_WINDOW_SIZE) {
-<a name="111" href="#111">111</a>       LogLog.warn(<span class="string">"Large window sizes are not allowed."</span>);
-<a name="112" href="#112">112</a>       maxIndex = minIndex + MAX_WINDOW_SIZE;
-<a name="113" href="#113">113</a>       LogLog.warn(<span class="string">"MaxIndex reduced to "</span> + String.valueOf(maxIndex) + <span class="string">"."</span>);
-<a name="114" href="#114">114</a>     }
-<a name="115" href="#115">115</a> 
-<a name="116" href="#116">116</a>     <a href="../../../../org/apache/log4j/pattern/PatternConverter.html">PatternConverter</a> itc = getIntegerPatternConverter();
-<a name="117" href="#117">117</a> 
-<a name="118" href="#118">118</a>     <strong>if</strong> (itc == <strong>null</strong>) {
-<a name="119" href="#119">119</a>       <strong>throw</strong> <strong>new</strong> IllegalStateException(
-<a name="120" href="#120">120</a>         <span class="string">"FileNamePattern ["</span> + getFileNamePattern()
-<a name="121" href="#121">121</a>         + <span class="string">"] does not contain a valid integer format specifier"</span>);
-<a name="122" href="#122">122</a>     }
-<a name="123" href="#123">123</a>   }
-<a name="124" href="#124">124</a> 
-<a name="125" href="#125">125</a>   <em>/**<em>*</em></em>
-<a name="126" href="#126">126</a> <em>   * {@inheritDoc}</em>
-<a name="127" href="#127">127</a> <em>   */</em>
-<a name="128" href="#128">128</a>   <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> initialize(
-<a name="129" href="#129">129</a>     <strong>final</strong> String file, <strong>final</strong> <strong>boolean</strong> append) {
-<a name="130" href="#130">130</a>     String newActiveFile = file;
-<a name="131" href="#131">131</a>     explicitActiveFile = false;
-<a name="132" href="#132">132</a> 
-<a name="133" href="#133">133</a>     <strong>if</strong> (activeFileName != <strong>null</strong>) {
-<a name="134" href="#134">134</a>       explicitActiveFile = <strong>true</strong>;
-<a name="135" href="#135">135</a>       newActiveFile = activeFileName;
-<a name="136" href="#136">136</a>     }
-<a name="137" href="#137">137</a> 
-<a name="138" href="#138">138</a>     <strong>if</strong> (file != <strong>null</strong>) {
-<a name="139" href="#139">139</a>       explicitActiveFile = <strong>true</strong>;
-<a name="140" href="#140">140</a>       newActiveFile = file;
-<a name="141" href="#141">141</a>     }
-<a name="142" href="#142">142</a> 
-<a name="143" href="#143">143</a>     <strong>if</strong> (!explicitActiveFile) {
-<a name="144" href="#144">144</a>       StringBuffer buf = <strong>new</strong> StringBuffer();
-<a name="145" href="#145">145</a>       formatFileName(<strong>new</strong> Integer(minIndex), buf);
-<a name="146" href="#146">146</a>       newActiveFile = buf.toString();
-<a name="147" href="#147">147</a>     }
-<a name="148" href="#148">148</a> 
-<a name="149" href="#149">149</a>     <strong>return</strong> <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescriptionImpl.html">RolloverDescriptionImpl</a>(<strong>new</strong>ActiveFile, append, <strong>null</strong>, <strong>null</strong>);
-<a name="150" href="#150">150</a>   }
-<a name="151" href="#151">151</a> 
-<a name="152" href="#152">152</a>   <em>/**<em>*</em></em>
-<a name="153" href="#153">153</a> <em>   * {@inheritDoc}</em>
-<a name="154" href="#154">154</a> <em>   */</em>
-<a name="155" href="#155">155</a>   <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> rollover(<strong>final</strong> String currentFileName) {
-<a name="156" href="#156">156</a>     <strong>if</strong> (maxIndex >= 0) {
-<a name="157" href="#157">157</a>       <strong>int</strong> purgeStart = minIndex;
-<a name="158" href="#158">158</a> 
-<a name="159" href="#159">159</a>       <strong>if</strong> (!explicitActiveFile) {
-<a name="160" href="#160">160</a>         purgeStart++;
-<a name="161" href="#161">161</a>       }
-<a name="162" href="#162">162</a> 
-<a name="163" href="#163">163</a>       <strong>if</strong> (!purge(purgeStart, maxIndex)) {
-<a name="164" href="#164">164</a>         <strong>return</strong> <strong>null</strong>;
-<a name="165" href="#165">165</a>       }
-<a name="166" href="#166">166</a> 
-<a name="167" href="#167">167</a>       StringBuffer buf = <strong>new</strong> StringBuffer();
-<a name="168" href="#168">168</a>       formatFileName(<strong>new</strong> Integer(purgeStart), buf);
-<a name="169" href="#169">169</a> 
-<a name="170" href="#170">170</a>       String renameTo = buf.toString();
-<a name="171" href="#171">171</a>       String compressedName = renameTo;
-<a name="172" href="#172">172</a>       <a href="../../../../org/apache/log4j/rolling/helper/Action.html">Action</a> compressAction = <strong>null</strong>;
-<a name="173" href="#173">173</a> 
-<a name="174" href="#174">174</a>       <strong>if</strong> (renameTo.endsWith(<span class="string">".gz"</span>)) {
-<a name="175" href="#175">175</a>         renameTo = renameTo.substring(0, renameTo.length() - 3);
-<a name="176" href="#176">176</a>         compressAction =
-<a name="177" href="#177">177</a>           <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/GZCompressAction.html">GZCompressAction</a>(
-<a name="178" href="#178">178</a>             <strong>new</strong> File(renameTo), <strong>new</strong> File(compressedName), <strong>true</strong>);
-<a name="179" href="#179">179</a>       } <strong>else</strong> <strong>if</strong> (renameTo.endsWith(<span class="string">".zip"</span>)) {
-<a name="180" href="#180">180</a>         renameTo = renameTo.substring(0, renameTo.length() - 4);
-<a name="181" href="#181">181</a>         compressAction =
-<a name="182" href="#182">182</a>           <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/ZipCompressAction.html">ZipCompressAction</a>(
-<a name="183" href="#183">183</a>             <strong>new</strong> File(renameTo), <strong>new</strong> File(compressedName), <strong>true</strong>);
-<a name="184" href="#184">184</a>       }
-<a name="185" href="#185">185</a> 
-<a name="186" href="#186">186</a>       <a href="../../../../org/apache/log4j/rolling/helper/FileRenameAction.html">FileRenameAction</a> renameAction =
-<a name="187" href="#187">187</a>         <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/FileRenameAction.html">FileRenameAction</a>(
-<a name="188" href="#188">188</a>           <strong>new</strong> File(currentFileName), <strong>new</strong> File(renameTo), false);
-<a name="189" href="#189">189</a> 
-<a name="190" href="#190">190</a>       <strong>return</strong> <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescriptionImpl.html">RolloverDescriptionImpl</a>(
-<a name="191" href="#191">191</a>         currentFileName, false, renameAction, compressAction);
-<a name="192" href="#192">192</a>     }
-<a name="193" href="#193">193</a> 
-<a name="194" href="#194">194</a>     <strong>return</strong> <strong>null</strong>;
-<a name="195" href="#195">195</a>   }
-<a name="196" href="#196">196</a> 
-<a name="197" href="#197">197</a>   <em>/**<em>*</em></em>
-<a name="198" href="#198">198</a> <em>   * Get index of oldest log file to be retained.</em>
-<a name="199" href="#199">199</a> <em>   * @return index of oldest log file.</em>
-<a name="200" href="#200">200</a> <em>   */</em>
-<a name="201" href="#201">201</a>   <strong>public</strong> <strong>int</strong> getMaxIndex() {
-<a name="202" href="#202">202</a>     <strong>return</strong> maxIndex;
-<a name="203" href="#203">203</a>   }
-<a name="204" href="#204">204</a> 
-<a name="205" href="#205">205</a>   <em>/**<em>*</em></em>
-<a name="206" href="#206">206</a> <em>   * Get index of most recent log file.</em>
-<a name="207" href="#207">207</a> <em>   * @return index of oldest log file.</em>
-<a name="208" href="#208">208</a> <em>   */</em>
-<a name="209" href="#209">209</a>   <strong>public</strong> <strong>int</strong> getMinIndex() {
-<a name="210" href="#210">210</a>     <strong>return</strong> minIndex;
-<a name="211" href="#211">211</a>   }
-<a name="212" href="#212">212</a> 
-<a name="213" href="#213">213</a>   <em>/**<em>*</em></em>
-<a name="214" href="#214">214</a> <em>   * Set index of oldest log file to be retained.</em>
-<a name="215" href="#215">215</a> <em>   * @param maxIndex index of oldest log file to be retained.</em>
-<a name="216" href="#216">216</a> <em>   */</em>
-<a name="217" href="#217">217</a>   <strong>public</strong> <strong>void</strong> setMaxIndex(<strong>int</strong> maxIndex) {
-<a name="218" href="#218">218</a>     <strong>this</strong>.maxIndex = maxIndex;
-<a name="219" href="#219">219</a>   }
-<a name="220" href="#220">220</a> 
-<a name="221" href="#221">221</a>   <em>/**<em>*</em></em>
-<a name="222" href="#222">222</a> <em>   * Set index of most recent log file.</em>
-<a name="223" href="#223">223</a> <em>   * @param minIndex Index of most recent log file.</em>
-<a name="224" href="#224">224</a> <em>   */</em>
-<a name="225" href="#225">225</a>   <strong>public</strong> <strong>void</strong> setMinIndex(<strong>int</strong> minIndex) {
-<a name="226" href="#226">226</a>     <strong>this</strong>.minIndex = minIndex;
-<a name="227" href="#227">227</a>   }
-<a name="228" href="#228">228</a> 
-<a name="229" href="#229">229</a>   <em>/**<em>*</em></em>
-<a name="230" href="#230">230</a> <em>   * Purge and rename old log files in preparation for rollover</em>
-<a name="231" href="#231">231</a> <em>   * @param lowIndex low index</em>
-<a name="232" href="#232">232</a> <em>   * @param highIndex high index.  Log file associated with high</em>
-<a name="233" href="#233">233</a> <em>   * index will be deleted if needed.</em>
-<a name="234" href="#234">234</a> <em>   * @return true if purge was successful and rollover should be attempted.</em>
-<a name="235" href="#235">235</a> <em>   */</em>
-<a name="236" href="#236">236</a>   <strong>private</strong> <strong>boolean</strong> purge(<strong>final</strong> <strong>int</strong> lowIndex, <strong>final</strong> <strong>int</strong> highIndex) {
-<a name="237" href="#237">237</a>     <strong>int</strong> suffixLength = 0;
-<a name="238" href="#238">238</a> 
-<a name="239" href="#239">239</a>     List renames = <strong>new</strong> ArrayList();
-<a name="240" href="#240">240</a>     StringBuffer buf = <strong>new</strong> StringBuffer();
-<a name="241" href="#241">241</a>     formatFileName(<strong>new</strong> Integer(lowIndex), buf);
-<a name="242" href="#242">242</a> 
-<a name="243" href="#243">243</a>     String lowFilename = buf.toString();
-<a name="244" href="#244">244</a> 
-<a name="245" href="#245">245</a>     <strong>if</strong> (lowFilename.endsWith(<span class="string">".gz"</span>)) {
-<a name="246" href="#246">246</a>       suffixLength = 3;
-<a name="247" href="#247">247</a>     } <strong>else</strong> <strong>if</strong> (lowFilename.endsWith(<span class="string">".zip"</span>)) {
-<a name="248" href="#248">248</a>       suffixLength = 4;
-<a name="249" href="#249">249</a>     }
-<a name="250" href="#250">250</a> 
-<a name="251" href="#251">251</a>     <strong>for</strong> (<strong>int</strong> i = lowIndex; i &lt;= highIndex; i++) {
-<a name="252" href="#252">252</a>       File toRename = <strong>new</strong> File(lowFilename);
-<a name="253" href="#253">253</a>       <strong>boolean</strong> isBase = false;
-<a name="254" href="#254">254</a> 
-<a name="255" href="#255">255</a>       <strong>if</strong> (suffixLength > 0) {
-<a name="256" href="#256">256</a>         File toRenameBase =
-<a name="257" href="#257">257</a>           <strong>new</strong> File(
-<a name="258" href="#258">258</a>             lowFilename.substring(0, lowFilename.length() - suffixLength));
-<a name="259" href="#259">259</a> 
-<a name="260" href="#260">260</a>         <strong>if</strong> (toRename.exists()) {
-<a name="261" href="#261">261</a>           <strong>if</strong> (toRenameBase.exists()) {
-<a name="262" href="#262">262</a>             toRenameBase.delete();
-<a name="263" href="#263">263</a>           }
-<a name="264" href="#264">264</a>         } <strong>else</strong> {
-<a name="265" href="#265">265</a>           toRename = toRenameBase;
-<a name="266" href="#266">266</a>           isBase = <strong>true</strong>;
-<a name="267" href="#267">267</a>         }
-<a name="268" href="#268">268</a>       }
-<a name="269" href="#269">269</a> 
-<a name="270" href="#270">270</a>       <strong>if</strong> (toRename.exists()) {
-<a name="271" href="#271">271</a>         <em class="comment">//</em>
-<a name="272" href="#272">272</a>         <em class="comment">//    if at upper index then</em>
-<a name="273" href="#273">273</a>         <em class="comment">//        attempt to delete last file</em>
-<a name="274" href="#274">274</a>         <em class="comment">//        if that fails then abandon purge</em>
-<a name="275" href="#275">275</a>         <strong>if</strong> (i == highIndex) {
-<a name="276" href="#276">276</a>           <strong>if</strong> (!toRename.delete()) {
-<a name="277" href="#277">277</a>             <strong>return</strong> false;
-<a name="278" href="#278">278</a>           }
-<a name="279" href="#279">279</a> 
-<a name="280" href="#280">280</a>           <strong>break</strong>;
-<a name="281" href="#281">281</a>         }
-<a name="282" href="#282">282</a> 
-<a name="283" href="#283">283</a>         <em class="comment">//</em>
-<a name="284" href="#284">284</a>         <em class="comment">//   if intermediate index</em>
-<a name="285" href="#285">285</a>         <em class="comment">//     add a rename action to the list</em>
-<a name="286" href="#286">286</a>         buf.setLength(0);
-<a name="287" href="#287">287</a>         formatFileName(<strong>new</strong> Integer(i + 1), buf);
-<a name="288" href="#288">288</a> 
-<a name="289" href="#289">289</a>         String highFilename = buf.toString();
-<a name="290" href="#290">290</a>         String renameTo = highFilename;
-<a name="291" href="#291">291</a> 
-<a name="292" href="#292">292</a>         <strong>if</strong> (isBase) {
-<a name="293" href="#293">293</a>           renameTo =
-<a name="294" href="#294">294</a>             highFilename.substring(0, highFilename.length() - suffixLength);
-<a name="295" href="#295">295</a>         }
-<a name="296" href="#296">296</a> 
-<a name="297" href="#297">297</a>         renames.add(<strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/FileRenameAction.html">FileRenameAction</a>(toRename, <strong>new</strong> File(renameTo), <strong>true</strong>));
-<a name="298" href="#298">298</a>         lowFilename = highFilename;
-<a name="299" href="#299">299</a>       } <strong>else</strong> {
-<a name="300" href="#300">300</a>         <strong>break</strong>;
-<a name="301" href="#301">301</a>       }
-<a name="302" href="#302">302</a>     }
-<a name="303" href="#303">303</a> 
-<a name="304" href="#304">304</a>     <em class="comment">//</em>
-<a name="305" href="#305">305</a>     <em class="comment">//   work renames backwards</em>
-<a name="306" href="#306">306</a>     <em class="comment">//</em>
-<a name="307" href="#307">307</a>     <strong>for</strong> (<strong>int</strong> i = renames.size() - 1; i >= 0; i--) {
-<a name="308" href="#308">308</a>       <a href="../../../../org/apache/log4j/rolling/helper/Action.html">Action</a> action = (Action) renames.get(i);
-<a name="309" href="#309">309</a> 
-<a name="310" href="#310">310</a>       <strong>try</strong> {
-<a name="311" href="#311">311</a>         <strong>if</strong> (!action.execute()) {
-<a name="312" href="#312">312</a>           <strong>return</strong> false;
-<a name="313" href="#313">313</a>         }
-<a name="314" href="#314">314</a>       } <strong>catch</strong> (Exception ex) {
-<a name="315" href="#315">315</a>         LogLog.warn(<span class="string">"Exception during purge in RollingFileAppender"</span>, ex);
-<a name="316" href="#316">316</a> 
-<a name="317" href="#317">317</a>         <strong>return</strong> false;
-<a name="318" href="#318">318</a>       }
-<a name="319" href="#319">319</a>     }
-<a name="320" href="#320">320</a> 
-<a name="321" href="#321">321</a>     <strong>return</strong> <strong>true</strong>;
-<a name="322" href="#322">322</a>   }
-<a name="323" href="#323">323</a> }
+<a name="62" href="#62">62</a>  <em> * */</em>
+<a name="63" href="#63">63</a>  <strong>public</strong> <strong>final</strong> <strong>class</strong> <a href="../../../../org/apache/log4j/rolling/FixedWindowRollingPolicy.html">FixedWindowRollingPolicy</a> <strong>extends</strong> <a href="../../../../org/apache/log4j/rolling/RollingPolicyBase.html">RollingPolicyBase</a> {
+<a name="64" href="#64">64</a>  
+<a name="65" href="#65">65</a>    <em>/**<em>*</em></em>
+<a name="66" href="#66">66</a>  <em>   * It's almost always a bad idea to have a large window size, say over 12.</em>
+<a name="67" href="#67">67</a>  <em>   */</em>
+<a name="68" href="#68">68</a>    <strong>private</strong> <strong>static</strong> <strong>final</strong> <strong>int</strong> MAX_WINDOW_SIZE = 12;
+<a name="69" href="#69">69</a>  
+<a name="70" href="#70">70</a>    <em>/**<em>*</em></em>
+<a name="71" href="#71">71</a>  <em>   * Index for oldest retained log file.</em>
+<a name="72" href="#72">72</a>  <em>   */</em>
+<a name="73" href="#73">73</a>    <strong>private</strong> <strong>int</strong> maxIndex;
+<a name="74" href="#74">74</a>  
+<a name="75" href="#75">75</a>    <em>/**<em>*</em></em>
+<a name="76" href="#76">76</a>  <em>   * Index for most recent log file.</em>
+<a name="77" href="#77">77</a>  <em>   */</em>
+<a name="78" href="#78">78</a>    <strong>private</strong> <strong>int</strong> minIndex;
+<a name="79" href="#79">79</a>  
+<a name="80" href="#80">80</a>    <em>/**<em>*</em></em>
+<a name="81" href="#81">81</a>  <em>   *  if true, then an explicit name for the active file was</em>
+<a name="82" href="#82">82</a>  <em>   * specified using RollingFileAppender.file or the</em>
+<a name="83" href="#83">83</a>  <em>   * redundent RollingPolicyBase.setActiveFile</em>
+<a name="84" href="#84">84</a>  <em>   */</em>
+<a name="85" href="#85">85</a>    <strong>private</strong> <strong>boolean</strong> explicitActiveFile;
+<a name="86" href="#86">86</a>  
+<a name="87" href="#87">87</a>    <em>/**<em>*</em></em>
+<a name="88" href="#88">88</a>  <em>   * Constructs a new instance.</em>
+<a name="89" href="#89">89</a>  <em>   */</em>
+<a name="90" href="#90">90</a>    <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/FixedWindowRollingPolicy.html">FixedWindowRollingPolicy</a>() {
+<a name="91" href="#91">91</a>      minIndex = 1;
+<a name="92" href="#92">92</a>      maxIndex = 7;
+<a name="93" href="#93">93</a>    }
+<a name="94" href="#94">94</a>  
+<a name="95" href="#95">95</a>    <em>/**<em>*</em></em>
+<a name="96" href="#96">96</a>  <em>   * {@inheritDoc}</em>
+<a name="97" href="#97">97</a>  <em>   */</em>
+<a name="98" href="#98">98</a>    <strong>public</strong> <strong>void</strong> activateOptions() {
+<a name="99" href="#99">99</a>      <strong>super</strong>.activateOptions();
+<a name="100" href="#100">100</a> 
+<a name="101" href="#101">101</a>     <strong>if</strong> (maxIndex &lt; minIndex) {
+<a name="102" href="#102">102</a>       LogLog.warn(
+<a name="103" href="#103">103</a>         <span class="string">"MaxIndex ("</span> + maxIndex + <span class="string">") cannot be smaller than MinIndex ("</span>
+<a name="104" href="#104">104</a>         + minIndex + <span class="string">")."</span>);
+<a name="105" href="#105">105</a>       LogLog.warn(<span class="string">"Setting maxIndex to equal minIndex."</span>);
+<a name="106" href="#106">106</a>       maxIndex = minIndex;
+<a name="107" href="#107">107</a>     }
+<a name="108" href="#108">108</a> 
+<a name="109" href="#109">109</a>     <strong>if</strong> ((maxIndex - minIndex) > MAX_WINDOW_SIZE) {
+<a name="110" href="#110">110</a>       LogLog.warn(<span class="string">"Large window sizes are not allowed."</span>);
+<a name="111" href="#111">111</a>       maxIndex = minIndex + MAX_WINDOW_SIZE;
+<a name="112" href="#112">112</a>       LogLog.warn(<span class="string">"MaxIndex reduced to "</span> + String.valueOf(maxIndex) + <span class="string">"."</span>);
+<a name="113" href="#113">113</a>     }
+<a name="114" href="#114">114</a> 
+<a name="115" href="#115">115</a>     <a href="../../../../org/apache/log4j/pattern/PatternConverter.html">PatternConverter</a> itc = getIntegerPatternConverter();
+<a name="116" href="#116">116</a> 
+<a name="117" href="#117">117</a>     <strong>if</strong> (itc == <strong>null</strong>) {
+<a name="118" href="#118">118</a>       <strong>throw</strong> <strong>new</strong> IllegalStateException(
+<a name="119" href="#119">119</a>         <span class="string">"FileNamePattern ["</span> + getFileNamePattern()
+<a name="120" href="#120">120</a>         + <span class="string">"] does not contain a valid integer format specifier"</span>);
+<a name="121" href="#121">121</a>     }
+<a name="122" href="#122">122</a>   }
+<a name="123" href="#123">123</a> 
+<a name="124" href="#124">124</a>   <em>/**<em>*</em></em>
+<a name="125" href="#125">125</a> <em>   * {@inheritDoc}</em>
+<a name="126" href="#126">126</a> <em>   */</em>
+<a name="127" href="#127">127</a>   <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> initialize(
+<a name="128" href="#128">128</a>     <strong>final</strong> String file, <strong>final</strong> <strong>boolean</strong> append) {
+<a name="129" href="#129">129</a>     String newActiveFile = file;
+<a name="130" href="#130">130</a>     explicitActiveFile = false;
+<a name="131" href="#131">131</a> 
+<a name="132" href="#132">132</a>     <strong>if</strong> (activeFileName != <strong>null</strong>) {
+<a name="133" href="#133">133</a>       explicitActiveFile = <strong>true</strong>;
+<a name="134" href="#134">134</a>       newActiveFile = activeFileName;
+<a name="135" href="#135">135</a>     }
+<a name="136" href="#136">136</a> 
+<a name="137" href="#137">137</a>     <strong>if</strong> (file != <strong>null</strong>) {
+<a name="138" href="#138">138</a>       explicitActiveFile = <strong>true</strong>;
+<a name="139" href="#139">139</a>       newActiveFile = file;
+<a name="140" href="#140">140</a>     }
+<a name="141" href="#141">141</a> 
+<a name="142" href="#142">142</a>     <strong>if</strong> (!explicitActiveFile) {
+<a name="143" href="#143">143</a>       StringBuffer buf = <strong>new</strong> StringBuffer();
+<a name="144" href="#144">144</a>       formatFileName(<strong>new</strong> Integer(minIndex), buf);
+<a name="145" href="#145">145</a>       newActiveFile = buf.toString();
+<a name="146" href="#146">146</a>     }
+<a name="147" href="#147">147</a> 
+<a name="148" href="#148">148</a>     <strong>return</strong> <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescriptionImpl.html">RolloverDescriptionImpl</a>(<strong>new</strong>ActiveFile, append, <strong>null</strong>, <strong>null</strong>);
+<a name="149" href="#149">149</a>   }
+<a name="150" href="#150">150</a> 
+<a name="151" href="#151">151</a>   <em>/**<em>*</em></em>
+<a name="152" href="#152">152</a> <em>   * {@inheritDoc}</em>
+<a name="153" href="#153">153</a> <em>   */</em>
+<a name="154" href="#154">154</a>   <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> rollover(<strong>final</strong> String currentFileName) {
+<a name="155" href="#155">155</a>     <strong>if</strong> (maxIndex >= 0) {
+<a name="156" href="#156">156</a>       <strong>int</strong> purgeStart = minIndex;
+<a name="157" href="#157">157</a> 
+<a name="158" href="#158">158</a>       <strong>if</strong> (!explicitActiveFile) {
+<a name="159" href="#159">159</a>         purgeStart++;
+<a name="160" href="#160">160</a>       }
+<a name="161" href="#161">161</a> 
+<a name="162" href="#162">162</a>       <strong>if</strong> (!purge(purgeStart, maxIndex)) {
+<a name="163" href="#163">163</a>         <strong>return</strong> <strong>null</strong>;
+<a name="164" href="#164">164</a>       }
+<a name="165" href="#165">165</a> 
+<a name="166" href="#166">166</a>       StringBuffer buf = <strong>new</strong> StringBuffer();
+<a name="167" href="#167">167</a>       formatFileName(<strong>new</strong> Integer(purgeStart), buf);
+<a name="168" href="#168">168</a> 
+<a name="169" href="#169">169</a>       String renameTo = buf.toString();
+<a name="170" href="#170">170</a>       String compressedName = renameTo;
+<a name="171" href="#171">171</a>       <a href="../../../../org/apache/log4j/rolling/helper/Action.html">Action</a> compressAction = <strong>null</strong>;
+<a name="172" href="#172">172</a> 
+<a name="173" href="#173">173</a>       <strong>if</strong> (renameTo.endsWith(<span class="string">".gz"</span>)) {
+<a name="174" href="#174">174</a>         renameTo = renameTo.substring(0, renameTo.length() - 3);
+<a name="175" href="#175">175</a>         compressAction =
+<a name="176" href="#176">176</a>           <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/GZCompressAction.html">GZCompressAction</a>(
+<a name="177" href="#177">177</a>             <strong>new</strong> File(renameTo), <strong>new</strong> File(compressedName), <strong>true</strong>);
+<a name="178" href="#178">178</a>       } <strong>else</strong> <strong>if</strong> (renameTo.endsWith(<span class="string">".zip"</span>)) {
+<a name="179" href="#179">179</a>         renameTo = renameTo.substring(0, renameTo.length() - 4);
+<a name="180" href="#180">180</a>         compressAction =
+<a name="181" href="#181">181</a>           <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/ZipCompressAction.html">ZipCompressAction</a>(
+<a name="182" href="#182">182</a>             <strong>new</strong> File(renameTo), <strong>new</strong> File(compressedName), <strong>true</strong>);
+<a name="183" href="#183">183</a>       }
+<a name="184" href="#184">184</a> 
+<a name="185" href="#185">185</a>       <a href="../../../../org/apache/log4j/rolling/helper/FileRenameAction.html">FileRenameAction</a> renameAction =
+<a name="186" href="#186">186</a>         <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/FileRenameAction.html">FileRenameAction</a>(
+<a name="187" href="#187">187</a>           <strong>new</strong> File(currentFileName), <strong>new</strong> File(renameTo), false);
+<a name="188" href="#188">188</a> 
+<a name="189" href="#189">189</a>       <strong>return</strong> <strong>new</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescriptionImpl.html">RolloverDescriptionImpl</a>(
+<a name="190" href="#190">190</a>         currentFileName, false, renameAction, compressAction);
+<a name="191" href="#191">191</a>     }
+<a name="192" href="#192">192</a> 
+<a name="193" href="#193">193</a>     <strong>return</strong> <strong>null</strong>;
+<a name="194" href="#194">194</a>   }
+<a name="195" href="#195">195</a> 
+<a name="196" href="#196">196</a>   <em>/**<em>*</em></em>
+<a name="197" href="#197">197</a> <em>   * Get index of oldest log file to be retained.</em>
+<a name="198" href="#198">198</a> <em>   * @return index of oldest log file.</em>
+<a name="199" href="#199">199</a> <em>   */</em>
+<a name="200" href="#200">200</a>   <strong>public</strong> <strong>int</strong> getMaxIndex() {
+<a name="201" href="#201">201</a>     <strong>return</strong> maxIndex;
+<a name="202" href="#202">202</a>   }
+<a name="203" href="#203">203</a> 
+<a name="204" href="#204">204</a>   <em>/**<em>*</em></em>
+<a name="205" href="#205">205</a> <em>   * Get index of most recent log file.</em>
+<a name="206" href="#206">206</a> <em>   * @return index of oldest log file.</em>
+<a name="207" href="#207">207</a> <em>   */</em>
+<a name="208" href="#208">208</a>   <strong>public</strong> <strong>int</strong> getMinIndex() {
+<a name="209" href="#209">209</a>     <strong>return</strong> minIndex;
+<a name="210" href="#210">210</a>   }
+<a name="211" href="#211">211</a> 
+<a name="212" href="#212">212</a>   <em>/**<em>*</em></em>
+<a name="213" href="#213">213</a> <em>   * Set index of oldest log file to be retained.</em>
+<a name="214" href="#214">214</a> <em>   * @param maxIndex index of oldest log file to be retained.</em>
+<a name="215" href="#215">215</a> <em>   */</em>
+<a name="216" href="#216">216</a>   <strong>public</strong> <strong>void</strong> setMaxIndex(<strong>int</strong> maxIndex) {
+<a name="217" href="#217">217</a>     <strong>this</strong>.maxIndex = maxIndex;
+<a name="218" href="#218">218</a>   }
+<a name="219" href="#219">219</a> 
+<a name="220" href="#220">220</a>   <em>/**<em>*</em></em>
+<a name="221" href="#221">221</a> <em>   * Set index of most recent log file.</em>
+<a name="222" href="#222">222</a> <em>   * @param minIndex Index of most recent log file.</em>
+<a name="223" href="#223">223</a> <em>   */</em>
+<a name="224" href="#224">224</a>   <strong>public</strong> <strong>void</strong> setMinIndex(<strong>int</strong> minIndex) {
+<a name="225" href="#225">225</a>     <strong>this</strong>.minIndex = minIndex;
+<a name="226" href="#226">226</a>   }
+<a name="227" href="#227">227</a> 
+<a name="228" href="#228">228</a>   <em>/**<em>*</em></em>
+<a name="229" href="#229">229</a> <em>   * Purge and rename old log files in preparation for rollover</em>
+<a name="230" href="#230">230</a> <em>   * @param lowIndex low index</em>
+<a name="231" href="#231">231</a> <em>   * @param highIndex high index.  Log file associated with high</em>
+<a name="232" href="#232">232</a> <em>   * index will be deleted if needed.</em>
+<a name="233" href="#233">233</a> <em>   * @return true if purge was successful and rollover should be attempted.</em>
+<a name="234" href="#234">234</a> <em>   */</em>
+<a name="235" href="#235">235</a>   <strong>private</strong> <strong>boolean</strong> purge(<strong>final</strong> <strong>int</strong> lowIndex, <strong>final</strong> <strong>int</strong> highIndex) {
+<a name="236" href="#236">236</a>     <strong>int</strong> suffixLength = 0;
+<a name="237" href="#237">237</a> 
+<a name="238" href="#238">238</a>     List renames = <strong>new</strong> ArrayList();
+<a name="239" href="#239">239</a>     StringBuffer buf = <strong>new</strong> StringBuffer();
+<a name="240" href="#240">240</a>     formatFileName(<strong>new</strong> Integer(lowIndex), buf);
+<a name="241" href="#241">241</a> 
+<a name="242" href="#242">242</a>     String lowFilename = buf.toString();
+<a name="243" href="#243">243</a> 
+<a name="244" href="#244">244</a>     <strong>if</strong> (lowFilename.endsWith(<span class="string">".gz"</span>)) {
+<a name="245" href="#245">245</a>       suffixLength = 3;
+<a name="246" href="#246">246</a>     } <strong>else</strong> <strong>if</strong> (lowFilename.endsWith(<span class="string">".zip"</span>)) {
+<a name="247" href="#247">247</a>       suffixLength = 4;
+<a name="248" href="#248">248</a>     }
+<a name="249" href="#249">249</a> 
+<a name="250" href="#250">250</a>     <strong>for</strong> (<strong>int</strong> i = lowIndex; i &lt;= highIndex; i++) {
+<a name="251" href="#251">251</a>       File toRename = <strong>new</strong> File(lowFilename);
+<a name="252" href="#252">252</a>       <strong>boolean</strong> isBase = false;
+<a name="253" href="#253">253</a> 
+<a name="254" href="#254">254</a>       <strong>if</strong> (suffixLength > 0) {
+<a name="255" href="#255">255</a>         File toRenameBase =
+<a name="256" href="#256">256</a>           <strong>new</strong> File(
+<a name="257" href="#257">257</a>             lowFilename.substring(0, lowFilename.length() - suffixLength));
+<a name="258" href="#258">258</a> 
+<a name="259" href="#259">259</a>         <strong>if</strong> (toRename.exists()) {
+<a name="260" href="#260">260</a>           <strong>if</strong> (toRenameBase.exists()) {
+<a name="261" href="#261">261</a>             toRenameBase.delete();
+<a name="262" href="#262">262</a>           }
+<a name="263" href="#263">263</a>         } <strong>else</strong> {
+<a name="264" href="#264">264</a>           toRename = toRenameBase;
+<a name="265" href="#265">265</a>           isBase = <strong>true</strong>;
+<a name="266" href="#266">266</a>         }
+<a name="267" href="#267">267</a>       }
+<a name="268" href="#268">268</a> 
+<a name="269" href="#269">269</a>       <strong>if</strong> (toRename.exists()) {
+<a name="270" href="#270">270</a>         <em class="comment">//</em>
+<a name="271" href="#271">271</a>         <em class="comment">//    if at upper index then</em>
+<a name="272" href="#272">272</a>         <em class="comment">//        attempt to delete last file</em>
+<a name="273" href="#273">273</a>         <em class="comment">//        if that fails then abandon purge</em>
+<a name="274" href="#274">274</a>         <strong>if</strong> (i == highIndex) {
+<a name="275" href="#275">275</a>           <strong>if</strong> (!toRename.delete()) {
+<a name="276" href="#276">276</a>             <strong>return</strong> false;
+<a name="277" href="#277">277</a>           }
+<a name="278" href="#278">278</a> 
+<a name="279" href="#279">279</a>           <strong>break</strong>;
+<a name="280" href="#280">280</a>         }
+<a name="281" href="#281">281</a> 
+<a name="282" href="#282">282</a>         <em class="comment">//</em>
+<a name="283" href="#283">283</a>         <em class="comment">//   if intermediate index</em>
+<a name="284" href="#284">284</a>         <em class="comment">//     add a rename action to the list</em>
+<a name="285" href="#285">285</a>         buf.setLength(0);
+<a name="286" href="#286">286</a>         formatFileName(<strong>new</strong> Integer(i + 1), buf);
+<a name="287" href="#287">287</a> 
+<a name="288" href="#288">288</a>         String highFilename = buf.toString();
+<a name="289" href="#289">289</a>         String renameTo = highFilename;
+<a name="290" href="#290">290</a> 
+<a name="291" href="#291">291</a>         <strong>if</strong> (isBase) {
+<a name="292" href="#292">292</a>           renameTo =
+<a name="293" href="#293">293</a>             highFilename.substring(0, highFilename.length() - suffixLength);
+<a name="294" href="#294">294</a>         }
+<a name="295" href="#295">295</a> 
+<a name="296" href="#296">296</a>         renames.add(<strong>new</strong> <a href="../../../../org/apache/log4j/rolling/helper/FileRenameAction.html">FileRenameAction</a>(toRename, <strong>new</strong> File(renameTo), <strong>true</strong>));
+<a name="297" href="#297">297</a>         lowFilename = highFilename;
+<a name="298" href="#298">298</a>       } <strong>else</strong> {
+<a name="299" href="#299">299</a>         <strong>break</strong>;
+<a name="300" href="#300">300</a>       }
+<a name="301" href="#301">301</a>     }
+<a name="302" href="#302">302</a> 
+<a name="303" href="#303">303</a>     <em class="comment">//</em>
+<a name="304" href="#304">304</a>     <em class="comment">//   work renames backwards</em>
+<a name="305" href="#305">305</a>     <em class="comment">//</em>
+<a name="306" href="#306">306</a>     <strong>for</strong> (<strong>int</strong> i = renames.size() - 1; i >= 0; i--) {
+<a name="307" href="#307">307</a>       <a href="../../../../org/apache/log4j/rolling/helper/Action.html">Action</a> action = (Action) renames.get(i);
+<a name="308" href="#308">308</a> 
+<a name="309" href="#309">309</a>       <strong>try</strong> {
+<a name="310" href="#310">310</a>         <strong>if</strong> (!action.execute()) {
+<a name="311" href="#311">311</a>           <strong>return</strong> false;
+<a name="312" href="#312">312</a>         }
+<a name="313" href="#313">313</a>       } <strong>catch</strong> (Exception ex) {
+<a name="314" href="#314">314</a>         LogLog.warn(<span class="string">"Exception during purge in RollingFileAppender"</span>, ex);
+<a name="315" href="#315">315</a> 
+<a name="316" href="#316">316</a>         <strong>return</strong> false;
+<a name="317" href="#317">317</a>       }
+<a name="318" href="#318">318</a>     }
+<a name="319" href="#319">319</a> 
+<a name="320" href="#320">320</a>     <strong>return</strong> <strong>true</strong>;
+<a name="321" href="#321">321</a>   }
+<a name="322" href="#322">322</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingFileAppender.html
URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingFileAppender.html?rev=569257&r1=569256&r2=569257&view=diff
==============================================================================
--- logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingFileAppender.html (original)
+++ logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingFileAppender.html Thu Aug 23 22:43:39 2007
@@ -58,7 +58,7 @@
 <a name="49" href="#49">49</a>  <em> * &lt;code>RollingPolicy&lt;/code> and a &lt;code>TriggeringPolicy&lt;/code>.</em>
 <a name="50" href="#50">50</a>  <em> *</em>
 <a name="51" href="#51">51</a>  <em> * &lt;p>&lt;code>RollingFileAppender&lt;/code> can be configured programattically or</em>
-<a name="52" href="#52">52</a>  <em> * using {@link org.apache.log4j.rolling.RollingConfigurator} or</em>
+<a name="52" href="#52">52</a>  <em> * using {@link org.apache.log4j.extras.DOMConfigurator} or</em>
 <a name="53" href="#53">53</a>  <em> * {@link org.apache.log4j.xml.DOMConfigurator} in log4j 1.2.15 or later. Here is a sample</em>
 <a name="54" href="#54">54</a>  <em> * configration file:</em>
 <a name="55" href="#55">55</a>  
@@ -450,125 +450,129 @@
 <a name="441" href="#441">441</a>                                           <strong>final</strong> Properties props) throws Exception {
 <a name="442" href="#442">442</a>       <strong>final</strong> String nodeName = element.getNodeName();
 <a name="443" href="#443">443</a>       <strong>if</strong> (<span class="string">"rollingPolicy"</span>.equals(nodeName)) {
-<a name="444" href="#444">444</a>           OptionHandler rollingPolicy = RollingConfigurator.parseElement(element, props, RollingPolicy.<strong>class</strong>);
-<a name="445" href="#445">445</a>           <strong>if</strong> (rollingPolicy != <strong>null</strong>) {
-<a name="446" href="#446">446</a>               rollingPolicy.activateOptions();
-<a name="447" href="#447">447</a>               <strong>this</strong>.setRollingPolicy((RollingPolicy) rollingPolicy);
-<a name="448" href="#448">448</a>           }
-<a name="449" href="#449">449</a>           <strong>return</strong> <strong>true</strong>;
-<a name="450" href="#450">450</a>       }
-<a name="451" href="#451">451</a>       <strong>if</strong> (<span class="string">"triggeringPolicy"</span>.equals(nodeName)) {
-<a name="452" href="#452">452</a>           OptionHandler triggerPolicy = RollingConfigurator.parseElement(element, props, TriggeringPolicy.<strong>class</strong>);
-<a name="453" href="#453">453</a>           <strong>if</strong> (triggerPolicy != <strong>null</strong>) {
-<a name="454" href="#454">454</a>               triggerPolicy.activateOptions();
-<a name="455" href="#455">455</a>               <strong>this</strong>.setTriggeringPolicy((TriggeringPolicy) triggerPolicy);
-<a name="456" href="#456">456</a>           }
-<a name="457" href="#457">457</a>           <strong>return</strong> <strong>true</strong>;
-<a name="458" href="#458">458</a>       }
-<a name="459" href="#459">459</a>       <strong>return</strong> false;
-<a name="460" href="#460">460</a>   }
-<a name="461" href="#461">461</a> 
-<a name="462" href="#462">462</a>   <em>/**<em>*</em></em>
-<a name="463" href="#463">463</a> <em>   * Wrapper for OutputStream that will report all write</em>
-<a name="464" href="#464">464</a> <em>   * operations back to this class for file length calculations.</em>
-<a name="465" href="#465">465</a> <em>   */</em>
-<a name="466" href="#466">466</a>   <strong>private</strong> <strong>static</strong> <strong>class</strong> CountingOutputStream <strong>extends</strong> OutputStream {
-<a name="467" href="#467">467</a>     <em>/**<em>*</em></em>
-<a name="468" href="#468">468</a> <em>     * Wrapped output stream.</em>
-<a name="469" href="#469">469</a> <em>     */</em>
-<a name="470" href="#470">470</a>     <strong>private</strong> <strong>final</strong> OutputStream os;
-<a name="471" href="#471">471</a> 
-<a name="472" href="#472">472</a>     <em>/**<em>*</em></em>
-<a name="473" href="#473">473</a> <em>     * Rolling file appender to inform of stream writes.</em>
-<a name="474" href="#474">474</a> <em>     */</em>
-<a name="475" href="#475">475</a>     <strong>private</strong> <strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> rfa;
-<a name="476" href="#476">476</a> 
-<a name="477" href="#477">477</a>     <em>/**<em>*</em></em>
-<a name="478" href="#478">478</a> <em>     * Constructor.</em>
-<a name="479" href="#479">479</a> <em>     * @param os output stream to wrap.</em>
-<a name="480" href="#480">480</a> <em>     * @param rfa rolling file appender to inform.</em>
-<a name="481" href="#481">481</a> <em>     */</em>
-<a name="482" href="#482">482</a>     <strong>public</strong> CountingOutputStream(
-<a name="483" href="#483">483</a>       <strong>final</strong> OutputStream os, <strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> rfa) {
-<a name="484" href="#484">484</a>       <strong>this</strong>.os = os;
-<a name="485" href="#485">485</a>       <strong>this</strong>.rfa = rfa;
-<a name="486" href="#486">486</a>     }
-<a name="487" href="#487">487</a> 
-<a name="488" href="#488">488</a>     <em>/**<em>*</em></em>
-<a name="489" href="#489">489</a> <em>     * {@inheritDoc}</em>
-<a name="490" href="#490">490</a> <em>     */</em>
-<a name="491" href="#491">491</a>     <strong>public</strong> <strong>void</strong> close() throws IOException {
-<a name="492" href="#492">492</a>       os.close();
-<a name="493" href="#493">493</a>     }
-<a name="494" href="#494">494</a> 
-<a name="495" href="#495">495</a>     <em>/**<em>*</em></em>
-<a name="496" href="#496">496</a> <em>     * {@inheritDoc}</em>
-<a name="497" href="#497">497</a> <em>     */</em>
-<a name="498" href="#498">498</a>     <strong>public</strong> <strong>void</strong> flush() throws IOException {
-<a name="499" href="#499">499</a>       os.flush();
-<a name="500" href="#500">500</a>     }
-<a name="501" href="#501">501</a> 
-<a name="502" href="#502">502</a>     <em>/**<em>*</em></em>
-<a name="503" href="#503">503</a> <em>     * {@inheritDoc}</em>
-<a name="504" href="#504">504</a> <em>     */</em>
-<a name="505" href="#505">505</a>     <strong>public</strong> <strong>void</strong> write(<strong>final</strong> byte[] b) throws IOException {
-<a name="506" href="#506">506</a>       os.write(b);
-<a name="507" href="#507">507</a>       rfa.incrementFileLength(b.length);
-<a name="508" href="#508">508</a>     }
-<a name="509" href="#509">509</a> 
-<a name="510" href="#510">510</a>     <em>/**<em>*</em></em>
-<a name="511" href="#511">511</a> <em>     * {@inheritDoc}</em>
-<a name="512" href="#512">512</a> <em>     */</em>
-<a name="513" href="#513">513</a>     <strong>public</strong> <strong>void</strong> write(<strong>final</strong> byte[] b, <strong>final</strong> <strong>int</strong> off, <strong>final</strong> <strong>int</strong> len)
-<a name="514" href="#514">514</a>       throws IOException {
-<a name="515" href="#515">515</a>       os.write(b, off, len);
-<a name="516" href="#516">516</a>       rfa.incrementFileLength(len);
-<a name="517" href="#517">517</a>     }
-<a name="518" href="#518">518</a> 
-<a name="519" href="#519">519</a>     <em>/**<em>*</em></em>
-<a name="520" href="#520">520</a> <em>     * {@inheritDoc}</em>
-<a name="521" href="#521">521</a> <em>     */</em>
-<a name="522" href="#522">522</a>     <strong>public</strong> <strong>void</strong> write(<strong>final</strong> <strong>int</strong> b) throws IOException {
-<a name="523" href="#523">523</a>       os.write(b);
-<a name="524" href="#524">524</a>       rfa.incrementFileLength(1);
-<a name="525" href="#525">525</a>     }
-<a name="526" href="#526">526</a>   }
-<a name="527" href="#527">527</a> 
-<a name="528" href="#528">528</a>     <strong>private</strong> <strong>static</strong> <strong>final</strong> <strong>class</strong> DefaultErrorHandler implements ErrorHandler {
-<a name="529" href="#529">529</a>         <strong>private</strong> <strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> appender;
-<a name="530" href="#530">530</a>         <strong>public</strong> DefaultErrorHandler(<strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> appender) {
-<a name="531" href="#531">531</a>             <strong>this</strong>.appender = appender;
-<a name="532" href="#532">532</a>         }
-<a name="533" href="#533">533</a>         <em>/**<em>*@since 1.2*/</em></em>
-<a name="534" href="#534">534</a>         <strong>public</strong> <strong>void</strong> setLogger(Logger logger) {
-<a name="535" href="#535">535</a> 
+<a name="444" href="#444">444</a>           OptionHandler rollingPolicy =
+<a name="445" href="#445">445</a>                   org.apache.log4j.extras.DOMConfigurator.parseElement(
+<a name="446" href="#446">446</a>                           element, props, RollingPolicy.<strong>class</strong>);
+<a name="447" href="#447">447</a>           <strong>if</strong> (rollingPolicy != <strong>null</strong>) {
+<a name="448" href="#448">448</a>               rollingPolicy.activateOptions();
+<a name="449" href="#449">449</a>               <strong>this</strong>.setRollingPolicy((RollingPolicy) rollingPolicy);
+<a name="450" href="#450">450</a>           }
+<a name="451" href="#451">451</a>           <strong>return</strong> <strong>true</strong>;
+<a name="452" href="#452">452</a>       }
+<a name="453" href="#453">453</a>       <strong>if</strong> (<span class="string">"triggeringPolicy"</span>.equals(nodeName)) {
+<a name="454" href="#454">454</a>           OptionHandler triggerPolicy =
+<a name="455" href="#455">455</a>                   org.apache.log4j.extras.DOMConfigurator.parseElement(
+<a name="456" href="#456">456</a>                           element, props, TriggeringPolicy.<strong>class</strong>);
+<a name="457" href="#457">457</a>           <strong>if</strong> (triggerPolicy != <strong>null</strong>) {
+<a name="458" href="#458">458</a>               triggerPolicy.activateOptions();
+<a name="459" href="#459">459</a>               <strong>this</strong>.setTriggeringPolicy((TriggeringPolicy) triggerPolicy);
+<a name="460" href="#460">460</a>           }
+<a name="461" href="#461">461</a>           <strong>return</strong> <strong>true</strong>;
+<a name="462" href="#462">462</a>       }
+<a name="463" href="#463">463</a>       <strong>return</strong> false;
+<a name="464" href="#464">464</a>   }
+<a name="465" href="#465">465</a> 
+<a name="466" href="#466">466</a>   <em>/**<em>*</em></em>
+<a name="467" href="#467">467</a> <em>   * Wrapper for OutputStream that will report all write</em>
+<a name="468" href="#468">468</a> <em>   * operations back to this class for file length calculations.</em>
+<a name="469" href="#469">469</a> <em>   */</em>
+<a name="470" href="#470">470</a>   <strong>private</strong> <strong>static</strong> <strong>class</strong> CountingOutputStream <strong>extends</strong> OutputStream {
+<a name="471" href="#471">471</a>     <em>/**<em>*</em></em>
+<a name="472" href="#472">472</a> <em>     * Wrapped output stream.</em>
+<a name="473" href="#473">473</a> <em>     */</em>
+<a name="474" href="#474">474</a>     <strong>private</strong> <strong>final</strong> OutputStream os;
+<a name="475" href="#475">475</a> 
+<a name="476" href="#476">476</a>     <em>/**<em>*</em></em>
+<a name="477" href="#477">477</a> <em>     * Rolling file appender to inform of stream writes.</em>
+<a name="478" href="#478">478</a> <em>     */</em>
+<a name="479" href="#479">479</a>     <strong>private</strong> <strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> rfa;
+<a name="480" href="#480">480</a> 
+<a name="481" href="#481">481</a>     <em>/**<em>*</em></em>
+<a name="482" href="#482">482</a> <em>     * Constructor.</em>
+<a name="483" href="#483">483</a> <em>     * @param os output stream to wrap.</em>
+<a name="484" href="#484">484</a> <em>     * @param rfa rolling file appender to inform.</em>
+<a name="485" href="#485">485</a> <em>     */</em>
+<a name="486" href="#486">486</a>     <strong>public</strong> CountingOutputStream(
+<a name="487" href="#487">487</a>       <strong>final</strong> OutputStream os, <strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> rfa) {
+<a name="488" href="#488">488</a>       <strong>this</strong>.os = os;
+<a name="489" href="#489">489</a>       <strong>this</strong>.rfa = rfa;
+<a name="490" href="#490">490</a>     }
+<a name="491" href="#491">491</a> 
+<a name="492" href="#492">492</a>     <em>/**<em>*</em></em>
+<a name="493" href="#493">493</a> <em>     * {@inheritDoc}</em>
+<a name="494" href="#494">494</a> <em>     */</em>
+<a name="495" href="#495">495</a>     <strong>public</strong> <strong>void</strong> close() throws IOException {
+<a name="496" href="#496">496</a>       os.close();
+<a name="497" href="#497">497</a>     }
+<a name="498" href="#498">498</a> 
+<a name="499" href="#499">499</a>     <em>/**<em>*</em></em>
+<a name="500" href="#500">500</a> <em>     * {@inheritDoc}</em>
+<a name="501" href="#501">501</a> <em>     */</em>
+<a name="502" href="#502">502</a>     <strong>public</strong> <strong>void</strong> flush() throws IOException {
+<a name="503" href="#503">503</a>       os.flush();
+<a name="504" href="#504">504</a>     }
+<a name="505" href="#505">505</a> 
+<a name="506" href="#506">506</a>     <em>/**<em>*</em></em>
+<a name="507" href="#507">507</a> <em>     * {@inheritDoc}</em>
+<a name="508" href="#508">508</a> <em>     */</em>
+<a name="509" href="#509">509</a>     <strong>public</strong> <strong>void</strong> write(<strong>final</strong> byte[] b) throws IOException {
+<a name="510" href="#510">510</a>       os.write(b);
+<a name="511" href="#511">511</a>       rfa.incrementFileLength(b.length);
+<a name="512" href="#512">512</a>     }
+<a name="513" href="#513">513</a> 
+<a name="514" href="#514">514</a>     <em>/**<em>*</em></em>
+<a name="515" href="#515">515</a> <em>     * {@inheritDoc}</em>
+<a name="516" href="#516">516</a> <em>     */</em>
+<a name="517" href="#517">517</a>     <strong>public</strong> <strong>void</strong> write(<strong>final</strong> byte[] b, <strong>final</strong> <strong>int</strong> off, <strong>final</strong> <strong>int</strong> len)
+<a name="518" href="#518">518</a>       throws IOException {
+<a name="519" href="#519">519</a>       os.write(b, off, len);
+<a name="520" href="#520">520</a>       rfa.incrementFileLength(len);
+<a name="521" href="#521">521</a>     }
+<a name="522" href="#522">522</a> 
+<a name="523" href="#523">523</a>     <em>/**<em>*</em></em>
+<a name="524" href="#524">524</a> <em>     * {@inheritDoc}</em>
+<a name="525" href="#525">525</a> <em>     */</em>
+<a name="526" href="#526">526</a>     <strong>public</strong> <strong>void</strong> write(<strong>final</strong> <strong>int</strong> b) throws IOException {
+<a name="527" href="#527">527</a>       os.write(b);
+<a name="528" href="#528">528</a>       rfa.incrementFileLength(1);
+<a name="529" href="#529">529</a>     }
+<a name="530" href="#530">530</a>   }
+<a name="531" href="#531">531</a> 
+<a name="532" href="#532">532</a>     <strong>private</strong> <strong>static</strong> <strong>final</strong> <strong>class</strong> DefaultErrorHandler implements ErrorHandler {
+<a name="533" href="#533">533</a>         <strong>private</strong> <strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> appender;
+<a name="534" href="#534">534</a>         <strong>public</strong> DefaultErrorHandler(<strong>final</strong> <a href="../../../../org/apache/log4j/rolling/RollingFileAppender.html">RollingFileAppender</a> appender) {
+<a name="535" href="#535">535</a>             <strong>this</strong>.appender = appender;
 <a name="536" href="#536">536</a>         }
-<a name="537" href="#537">537</a>         <strong>public</strong> <strong>void</strong> error(String message, Exception ioe, <strong>int</strong> errorCode) {
-<a name="538" href="#538">538</a>           appender.close();
-<a name="539" href="#539">539</a>           LogLog.error(<span class="string">"IO failure for appender named "</span>+ appender.getName(), ioe);
+<a name="537" href="#537">537</a>         <em>/**<em>*@since 1.2*/</em></em>
+<a name="538" href="#538">538</a>         <strong>public</strong> <strong>void</strong> setLogger(Logger logger) {
+<a name="539" href="#539">539</a> 
 <a name="540" href="#540">540</a>         }
-<a name="541" href="#541">541</a>         <strong>public</strong> <strong>void</strong> error(String message) {
-<a name="542" href="#542">542</a> 
-<a name="543" href="#543">543</a>         }
-<a name="544" href="#544">544</a>         <em>/**<em>*@since 1.2*/</em></em>
-<a name="545" href="#545">545</a>         <strong>public</strong> <strong>void</strong> error(String message, Exception e, <strong>int</strong> errorCode, LoggingEvent event) {
+<a name="541" href="#541">541</a>         <strong>public</strong> <strong>void</strong> error(String message, Exception ioe, <strong>int</strong> errorCode) {
+<a name="542" href="#542">542</a>           appender.close();
+<a name="543" href="#543">543</a>           LogLog.error(<span class="string">"IO failure for appender named "</span>+ appender.getName(), ioe);
+<a name="544" href="#544">544</a>         }
+<a name="545" href="#545">545</a>         <strong>public</strong> <strong>void</strong> error(String message) {
 <a name="546" href="#546">546</a> 
 <a name="547" href="#547">547</a>         }
 <a name="548" href="#548">548</a>         <em>/**<em>*@since 1.2*/</em></em>
-<a name="549" href="#549">549</a>         <strong>public</strong> <strong>void</strong> setAppender(Appender appender) {
+<a name="549" href="#549">549</a>         <strong>public</strong> <strong>void</strong> error(String message, Exception e, <strong>int</strong> errorCode, LoggingEvent event) {
 <a name="550" href="#550">550</a> 
 <a name="551" href="#551">551</a>         }
 <a name="552" href="#552">552</a>         <em>/**<em>*@since 1.2*/</em></em>
-<a name="553" href="#553">553</a>         <strong>public</strong> <strong>void</strong> setBackupAppender(Appender appender) {
+<a name="553" href="#553">553</a>         <strong>public</strong> <strong>void</strong> setAppender(Appender appender) {
 <a name="554" href="#554">554</a> 
 <a name="555" href="#555">555</a>         }
-<a name="556" href="#556">556</a> 
-<a name="557" href="#557">557</a>         <strong>public</strong> <strong>void</strong> activateOptions() {
-<a name="558" href="#558">558</a>         }
-<a name="559" href="#559">559</a> 
-<a name="560" href="#560">560</a>     }
-<a name="561" href="#561">561</a> 
-<a name="562" href="#562">562</a> }
+<a name="556" href="#556">556</a>         <em>/**<em>*@since 1.2*/</em></em>
+<a name="557" href="#557">557</a>         <strong>public</strong> <strong>void</strong> setBackupAppender(Appender appender) {
+<a name="558" href="#558">558</a> 
+<a name="559" href="#559">559</a>         }
+<a name="560" href="#560">560</a> 
+<a name="561" href="#561">561</a>         <strong>public</strong> <strong>void</strong> activateOptions() {
+<a name="562" href="#562">562</a>         }
+<a name="563" href="#563">563</a> 
+<a name="564" href="#564">564</a>     }
+<a name="565" href="#565">565</a> 
+<a name="566" href="#566">566</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingPolicy.html
URL: http://svn.apache.org/viewvc/logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingPolicy.html?rev=569257&r1=569256&r2=569257&view=diff
==============================================================================
--- logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingPolicy.html (original)
+++ logging/site/trunk/docs/log4j/companions/extras/xref/org/apache/log4j/rolling/RollingPolicy.html Thu Aug 23 22:43:39 2007
@@ -34,34 +34,33 @@
 <a name="25" href="#25">25</a>  <em> *</em>
 <a name="26" href="#26">26</a>  <em> * @author Ceki G&amp;uuml;lc&amp;uuml;</em>
 <a name="27" href="#27">27</a>  <em> * @author Curt Arnold</em>
-<a name="28" href="#28">28</a>  <em> * @since 1.3</em>
-<a name="29" href="#29">29</a>  <em> * */</em>
-<a name="30" href="#30">30</a>  <strong>public</strong> <strong>interface</strong> <a href="../../../../org/apache/log4j/rolling/RollingPolicy.html">RollingPolicy</a> <strong>extends</strong> OptionHandler {
-<a name="31" href="#31">31</a>    <em>/**<em>*</em></em>
-<a name="32" href="#32">32</a>  <em>   * Initialize the policy and return any initial actions for rolling file appender..</em>
-<a name="33" href="#33">33</a>  <em>   *</em>
-<a name="34" href="#34">34</a>  <em>   * @param file current value of RollingFileAppender.getFile().</em>
-<a name="35" href="#35">35</a>  <em>   * @param append current value of RollingFileAppender.getAppend().</em>
-<a name="36" href="#36">36</a>  <em>   * @return Description of the initialization, may be null to indicate</em>
-<a name="37" href="#37">37</a>  <em>   * no initialization needed.</em>
-<a name="38" href="#38">38</a>  <em>   * @throws SecurityException if denied access to log files.</em>
-<a name="39" href="#39">39</a>  <em>   */</em>
-<a name="40" href="#40">40</a>    <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> initialize(
-<a name="41" href="#41">41</a>      <strong>final</strong> String file, <strong>final</strong> <strong>boolean</strong> append) throws SecurityException;
-<a name="42" href="#42">42</a>  
-<a name="43" href="#43">43</a>    <em>/**<em>*</em></em>
-<a name="44" href="#44">44</a>  <em>   * Prepare for a rollover.  This method is called prior to</em>
-<a name="45" href="#45">45</a>  <em>   * closing the active log file, performs any necessary</em>
-<a name="46" href="#46">46</a>  <em>   * preliminary actions and describes actions needed</em>
-<a name="47" href="#47">47</a>  <em>   * after close of current log file.</em>
-<a name="48" href="#48">48</a>  <em>   *</em>
-<a name="49" href="#49">49</a>  <em>   * @param activeFile file name for current active log file.</em>
-<a name="50" href="#50">50</a>  <em>   * @return Description of pending rollover, may be null to indicate no rollover</em>
-<a name="51" href="#51">51</a>  <em>   * at this time.</em>
-<a name="52" href="#52">52</a>  <em>   * @throws SecurityException if denied access to log files.</em>
-<a name="53" href="#53">53</a>  <em>   */</em>
-<a name="54" href="#54">54</a>    <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> rollover(<strong>final</strong> String activeFile) throws SecurityException;
-<a name="55" href="#55">55</a>  }
+<a name="28" href="#28">28</a>  <em> * */</em>
+<a name="29" href="#29">29</a>  <strong>public</strong> <strong>interface</strong> <a href="../../../../org/apache/log4j/rolling/RollingPolicy.html">RollingPolicy</a> <strong>extends</strong> OptionHandler {
+<a name="30" href="#30">30</a>    <em>/**<em>*</em></em>
+<a name="31" href="#31">31</a>  <em>   * Initialize the policy and return any initial actions for rolling file appender..</em>
+<a name="32" href="#32">32</a>  <em>   *</em>
+<a name="33" href="#33">33</a>  <em>   * @param file current value of RollingFileAppender.getFile().</em>
+<a name="34" href="#34">34</a>  <em>   * @param append current value of RollingFileAppender.getAppend().</em>
+<a name="35" href="#35">35</a>  <em>   * @return Description of the initialization, may be null to indicate</em>
+<a name="36" href="#36">36</a>  <em>   * no initialization needed.</em>
+<a name="37" href="#37">37</a>  <em>   * @throws SecurityException if denied access to log files.</em>
+<a name="38" href="#38">38</a>  <em>   */</em>
+<a name="39" href="#39">39</a>    <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> initialize(
+<a name="40" href="#40">40</a>      <strong>final</strong> String file, <strong>final</strong> <strong>boolean</strong> append) throws SecurityException;
+<a name="41" href="#41">41</a>  
+<a name="42" href="#42">42</a>    <em>/**<em>*</em></em>
+<a name="43" href="#43">43</a>  <em>   * Prepare for a rollover.  This method is called prior to</em>
+<a name="44" href="#44">44</a>  <em>   * closing the active log file, performs any necessary</em>
+<a name="45" href="#45">45</a>  <em>   * preliminary actions and describes actions needed</em>
+<a name="46" href="#46">46</a>  <em>   * after close of current log file.</em>
+<a name="47" href="#47">47</a>  <em>   *</em>
+<a name="48" href="#48">48</a>  <em>   * @param activeFile file name for current active log file.</em>
+<a name="49" href="#49">49</a>  <em>   * @return Description of pending rollover, may be null to indicate no rollover</em>
+<a name="50" href="#50">50</a>  <em>   * at this time.</em>
+<a name="51" href="#51">51</a>  <em>   * @throws SecurityException if denied access to log files.</em>
+<a name="52" href="#52">52</a>  <em>   */</em>
+<a name="53" href="#53">53</a>    <strong>public</strong> <a href="../../../../org/apache/log4j/rolling/RolloverDescription.html">RolloverDescription</a> rollover(<strong>final</strong> String activeFile) throws SecurityException;
+<a name="54" href="#54">54</a>  }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>



Mime
View raw message