Modified: websites/production/logging/content/log4cxx/0.10.0/usage.html ============================================================================== --- websites/production/logging/content/log4cxx/0.10.0/usage.html (original) +++ websites/production/logging/content/log4cxx/0.10.0/usage.html Thu Nov 22 09:01:01 2018 @@ -15,11 +15,11 @@ See the License for the specific language governing permissions and limitations under the License. --> -<!-- Generated by Apache Maven Doxia at 2018-01-27 --> +<!-- Generated by Apache Maven Doxia at 2018-11-22 --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <title>log4cxx - + <title>log4cxx - How to use Apache log4cxx - Apache log4cxx</title> <link rel="stylesheet" href="./css/bootstrap.min.css" type="text/css" /> <link rel="stylesheet" href="./css/site.css" type="text/css" /> @@ -27,9 +27,9 @@ <script type="text/javascript" src="./js/bootstrap.min.js"></script> <script type="text/javascript" src="./js/prettify.min.js"></script> <script type="text/javascript" src="./js/site.js"></script> - <meta name="Date-Revision-yyyymmdd" content="20180127" /> + <meta name="Date-Revision-yyyymmdd" content="20181122" /> <meta http-equiv="Content-Language" content="en" /> - + </head> <body class="composite"> <a href="https://logging.apache.org/"> @@ -44,31 +44,31 @@ <a class="brand" href="http://logging.apache.org/log4cxx">Apache log4cxx ™</a> <ul class="nav"> <li> - - + + <a href="https://wiki.apache.org/logging" class="external" target="_blank" title="Logging Wiki">Logging Wiki</a> </li> <li> - - + + <a href="https://www.apache.org/" class="external" target="_blank" title="Apache">Apache</a> </li> <li> - - + + <a href="https://logging.apache.org/" class="external" target="_blank" title="Logging Services">Logging Services</a> </li> <li> - - + + <a href="https://github.com/apache/logging-log4cxx" class="external" target="_blank" title="GitHub">GitHub</a> </li> </ul> <div class="pull-right"> - - - <span id="publishDate">Last Published: 2018-01-27</span> + + + <span id="publishDate">Last Published: 2018-11-22</span> <span class="divider">|</span> <span id="projectVersion">Version: 0.10.0</span> </div> </div> @@ -125,8 +125,8 @@ <a href="issue-tracking.html" title="Issue Tracking">Issue Tracking</a> </li> <li class="none"> - - + + <a href="http://wiki.apache.org/logging-log4cxx" class="external" target="_blank" title="Wiki">Wiki</a> </li> </ul> @@ -162,23 +162,23 @@ <ul class="nav nav-list"> <li class="nav-header"><i class="icon-info-sign"></i>Apache</li> <li class="none"> - - + + <a href="http://www.apache.org" class="external" target="_blank" title="Home">Home</a> </li> <li class="none"> - - + + <a href="http://www.apache.org/foundation/sponsorship.html" class="external" target="_blank" title="Sponsorship">Sponsorship</a> </li> <li class="none"> - - + + <a href="http://www.apache.org/foundation/thanks.html" class="external" target="_blank" title="Thanks">Thanks</a> </li> <li class="none"> - - + + <a href="http://www.apachecon.com" class="external" target="_blank" title="Conferences">Conferences</a> </li> </ul> @@ -204,10 +204,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + <div class="section"> <h2>Loggers<a name="Loggers"></a></h2> - + <p> Log4cxx has three main components: <i>loggers</i>, <i>appenders</i> and <i>layouts</i>. These three types of @@ -216,10 +216,10 @@ messages are formatted and where they are reported. </p> - + <div class="section"> <h3>Hierarchy<a name="Hierarchy"></a></h3> - + <p> The first and foremost advantage of any logging API over plain <tt>std::cout</tt> resides in its ability to disable @@ -229,17 +229,17 @@ developer-chosen criteria. </p> - + <p> Loggers are named entities. Logger names are case-sensitive and they follow the hierarchical naming rule: </p> - + <dl> - + <dt><b>Named Hierarchy</b></dt> - + <dd> A logger is said to be an <i>ancestor</i> of another logger if its name followed by a dot is a prefix of the @@ -249,7 +249,7 @@ </dd> </dl> - + <p> For example, the logger named <tt>"com.foo"</tt> is a parent of the logger named <tt>"com.foo.Bar"</tt>. Similarly, @@ -258,21 +258,21 @@ should be familiar to most developers. </p> - + <p> The root logger resides at the top of the logger hierarchy. It is exceptional in two ways: </p> - + <ol style="list-style-type: decimal"> - + <li> it always exists,</li> - + <li> it cannot be retrieved by name.</li> </ol> - + <p> Invoking the class static <a href="apidocs/classlog4cxx_1_1_logger.html#afc0e4d99cab7c38a2851d41e6edc1dee">log4cxx::Logger::getRootLogger</a> method retrieves it. All other loggers are instantiated and retrieved with the class static @@ -281,7 +281,7 @@ class are listed below. </p> - + <div> <pre class="prettyprint linenums"> namespace log4cxx { @@ -308,10 +308,10 @@ namespace log4cxx { #define LOG4CXX_FATAL(logger, expression) ...</pre></div> </div> - + <div class="section"> <h3>Levels<a name="Levels"></a></h3> - + <p> Loggers <i>may</i> be assigned levels. The pre-defined levels: TRACE, DEBUG, INFO, WARN, ERROR and FATAL are defined in the @@ -319,19 +319,19 @@ namespace log4cxx { class which provides accessor functions. </p> - + <p> If a given logger is not assigned a level, then it inherits one from its closest ancestor with an assigned level. More formally: </p> - + <dl> - + <dt><b>Level Inheritance</b></dt> - + <dd> The <i>inherited level</i> for a given logger <i>C</i>, is equal to the first non-null level in the logger hierarchy, starting at <i>C</i> and @@ -339,69 +339,69 @@ namespace log4cxx { </dd> </dl> - + <p> To ensure that all loggers can eventually inherit a level, the root logger always has an assigned level. </p> - + <p> Below are four tables with various assigned level values and the resulting inherited levels according to the above rule. </p> - + <table class="bodyTable" border="1"><caption align="bottom">Example 1</caption> - + <tr class="a"> - + <th>Logger name</th> - + <th>Assigned level</th> - + <th>Inherited level</th> </tr> - + <tr class="b" align="left"> - + <td>root</td> - + <td>Proot</td> - + <td>Proot</td> </tr> - + <tr class="a" align="left"> - + <td>X </td> - + <td>none</td> - + <td>Proot</td> </tr> - + <tr class="b" align="left"> - + <td>X.Y </td> - + <td>none</td> - + <td>Proot</td> </tr> - + <tr class="a" align="left"> - + <td>X.Y.Z</td> - + <td>none</td> - + <td>Proot</td> </tr> - + </table> - + <p> In example 1 above, only the root logger is assigned a level. This level value, <tt>Proot</tt>, is inherited by the @@ -409,113 +409,113 @@ namespace log4cxx { <tt>X.Y.Z</tt>. </p> - + <table class="bodyTable" border="1"><caption align="bottom">Example 2</caption> - + <tr class="a"> - + <th>Logger name</th> - + <th>Assigned level</th> - + <th>Inherited level</th> </tr> - + <tr class="b" align="left"> - + <td>root</td> - + <td>Proot</td> - + <td>Proot</td> </tr> - + <tr class="a" align="left"> - + <td>X </td> - + <td>Px</td> - + <td>Px</td> </tr> - + <tr class="b" align="left"> - + <td>X.Y </td> - + <td>Pxy</td> - + <td>Pxy</td> </tr> - + <tr class="a" align="left"> - + <td>X.Y.Z</td> - + <td>Pxyz</td> - + <td>Pxyz</td> </tr> - + </table> - + <p> In example 2, all loggers have an assigned level value. There is no need for level inheritence. </p> - + <table class="bodyTable" border="1"><caption align="bottom">Example 3</caption> - + <tr class="a"> - + <th>Logger name</th> - + <th>Assigned level</th> - + <th>Inherited level</th> </tr> - + <tr class="b" align="left"> - + <td>root</td> - + <td>Proot</td> - + <td>Proot</td> </tr> - + <tr class="a" align="left"> - + <td>X </td> - + <td>Px</td> - + <td>Px</td> </tr> - + <tr class="b" align="left"> - + <td>X.Y </td> - + <td>none</td> - + <td>Px</td> </tr> - + <tr class="a" align="left"> - + <td>X.Y.Z</td> - + <td>Pxyz</td> - + <td>Pxyz</td> </tr> - + </table> - + <p> In example 3, the loggers <tt>root</tt>, <tt>X</tt> and <tt>X.Y.Z</tt> are assigned the levels <tt>Proot</tt>, @@ -524,57 +524,57 @@ namespace log4cxx { <tt>X</tt>. </p> - + <table class="bodyTable" border="1"><caption align="bottom">Example 4</caption> - + <tr class="a"> - + <th>Logger name</th> - + <th>Assigned level</th> - + <th>Inherited level</th> </tr> - + <tr class="b" align="left"> - + <td>root</td> - + <td>Proot</td> - + <td>Proot</td> </tr> - + <tr class="a" align="left"> - + <td>X </td> - + <td>Px</td> - + <td>Px</td> </tr> - + <tr class="b" align="left"> - + <td>X.Y </td> - + <td>none</td> - + <td>Px</td> </tr> - + <tr class="a" align="left"> - + <td>X.Y.Z</td> - + <td>none</td> - + <td>Px</td> </tr> - + </table> - + <p> In example 4, the loggers <tt>root</tt> and <tt>X</tt> and are assigned the levels <tt>Proot</tt> and <tt>Px</tt> @@ -584,10 +584,10 @@ namespace log4cxx { </p> </div> - + <div class="section"> <h3>Requests<a name="Requests"></a></h3> - + <p> Logging requests are made by invoking a method of a logger instance, preferrably through the use of LOG4CXX_INFO or similar @@ -595,7 +595,7 @@ namespace log4cxx { and use of the insertion operator (<<) in the message parameter. </p> - + <div> <pre class="prettyprint linenums"> log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(<b>"com.foo"</b>)); @@ -609,7 +609,7 @@ LOG4CXX_DEBUG(logger, "e^10 = " // LOG4CXX_WARN(logger, L"" << i << L" is the number of the iteration.")</pre></div> - + <p> A logging request is said to be <i>enabled</i> if its level is higher than or equal to the level of its logger. Otherwise, the @@ -618,12 +618,12 @@ LOG4CXX_WARN(logger, L"" <& summarized below. </p> - + <dl> - + <dt><b>Basic Selection Rule</b></dt> - + <dd> A log request of level <i>p</i> in a logger with (either assigned or inherited, whichever is appropriate) level <i>q</i>, is enabled if @@ -631,19 +631,19 @@ LOG4CXX_WARN(logger, L"" <& </dd> </dl> - + <p> This rule is at the heart of log4cxx. It assumes that levels are ordered. For the standard levels, we have <tt>TRACE < DEBUG < INFO < WARN < ERROR < FATAL</tt>. </p> - + <p> Here is an example of this rule. </p> - + <div> <pre class="prettyprint linenums"> // get a logger instance named "com.foo" @@ -671,28 +671,28 @@ LOG4CXX_INFO(barlogger. "Located ne // This request is disabled, because <b>DEBUG</b> < <b>INFO</b>. LOG4CXX_DEBUG(barlogger, "Exiting gas station search")</pre></div> - + <p> Calling the <tt>getLogger</tt> method with the same name will always return a reference to the exact same logger object. </p> - + <p> For example, in </p> - + <div> <pre class="prettyprint linenums"> log4cxx::LoggerPtr x = log4cxx::Logger::getLogger("wombat"); log4cxx::LoggerPtr y = log4cxx::Logger::getLogger("wombat");</pre></div> - + <p> <tt>x</tt> and <tt>y</tt> refer to <i>exactly</i> the same logger object. </p> - + <p> Thus, it is possible to configure a logger and then to retrieve the same instance somewhere else in the code without passing around @@ -703,14 +703,14 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: instantiated after them. </p> - + <p> Configuration of the log4cxx environment is typically done at application initialization. The preferred way is by reading a configuration file. This approach will be discussed shortly. </p> - + <p> Log4cxx makes it easy to name loggers by <i>software component</i>. This can be accomplished by statically instantiating @@ -724,7 +724,7 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: loggers as desired. </p> - + <p> Nevertheless, naming loggers after the class where they are located seems to be the best strategy known so far. @@ -732,10 +732,10 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: </div> </div> - + <div class="section"> <h2>Appenders and Layouts<a name="Appenders_and_Layouts"></a></h2> - + <p> The ability to selectively enable or disable logging requests based on their logger is only part of the picture. Log4cxx allows logging @@ -749,10 +749,10 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: daemons. It is also possible to log <a href="apidocs/classlog4cxx_1_1_async_appender.html">asynchronously</a>. </p> - + <p>More than one appender can be attached to a logger.</p> - + <p> The <a href="apidocs/classlog4cxx_1_1_logger.html#a7c0629acee8dbd1251474bea15d7c9e2">addAppender</a> method adds an appender to a given logger. @@ -771,15 +771,15 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: <tt>false</tt>. </p> - + <p>The rules governing appender additivity are summarized below.</p> - + <dl> - + <dt><b>Appender Additivity</b></dt> - + <dd> The output of a log statement of logger <i>C</i> will go to all the appenders in <i>C</i> and its ancestors. This is the meaning of the term "appender @@ -792,108 +792,108 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: </dd> </dl> - + <p>The table below shows an example:</p> - + <table class="bodyTable" align="center" border="3" cellpadding="10"> - + <tr class="a"> - + <th>Logger Name </th> - + <th>Added Appenders</th> - + <th>Additivity Flag</th> - + <th>Output Targets</th> - + <th>Comment</th> </tr> - + <tr class="b"> - + <td>root</td> - + <td>A1</td> - + <td>not applicable</td> - + <td>A1</td> - + <td> The root logger is anonymous but can be accessed with the log4cxx::Logger::getRootLogger() method. There is no default appender attached to root. </td> </tr> - + <tr class="a"> - + <td>x</td> - + <td>A-x1, A-x2</td> - + <td>true</td> - + <td>A1, A-x1, A-x2</td> - + <td>Appenders of "x" and root.</td> </tr> - + <tr class="b"> - + <td>x.y</td> - + <td>none</td> - + <td>true</td> - + <td>A1, A-x1, A-x2</td> - + <td>Appenders of "x" and root.</td> </tr> - + <tr class="a"> - + <td>x.y.z</td> - + <td>A-xyz1</td> - + <td>true</td> - + <td>A1, A-x1, A-x2, A-xyz1</td> - + <td>Appenders in "x.y.z", "x" and root.</td> </tr> - + <tr class="b"> - + <td>security</td> - + <td>A-sec</td> - + <td> <span class="activity-flag-highlight">false</span> </td> - + <td>A-sec</td> - + <td> No appender accumulation since the additivity flag is set to <tt>false</tt>. </td> </tr> - + <tr class="a"> - + <td>security.access</td> - + <td>none</td> - + <td>true</td> - + <td>A-sec</td> - + <td> Only appenders of "security" because the additivity flag in "security" is set to <tt>false</tt>. @@ -901,7 +901,7 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: </tr> </table> - + <p> More often than not, users wish to customize not only the output destination but also the output format. This is accomplished by @@ -911,7 +911,7 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: to its destination. </p> - + <p> The <a href="apidocs/classlog4cxx_1_1_pattern_layout.html">PatternLayout</a>, part of the standard log4cxx distribution, lets the user specify the output @@ -919,18 +919,18 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: <tt>printf</tt> function. </p> - + <p> For example, the PatternLayout with the conversion pattern "%r [%t] %-5p %c - %m%n" will output something akin to: </p> - + <div> <pre class="prettyprint linenums"> 176 [main] INFO org.foo.Bar - Located nearest gas station.</pre></div> - + <p> The first field is the number of milliseconds elapsed since the start of the program. The second field is the thread making the log @@ -940,10 +940,10 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: </p> </div> - + <div class="section"> <h2>Configuration<a name="Configuration"></a></h2> - + <p> Inserting log requests into the application code requires a fair amount of planning and effort. Observation shows that approximately 4 @@ -953,7 +953,7 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: manage these log statements without the need to modify them manually. </p> - + <p> The log4cxx environment is fully configurable programmatically. However, it is far more flexible to configure log4cxx using @@ -961,13 +961,13 @@ log4cxx::LoggerPtr y = log4cxx::Logger:: XML or in Java properties (key=value) format. </p> - + <p> Let us give a taste of how this is done with the help of an imaginary application <tt>MyApp</tt> that uses log4cxx. </p> - + <div> <pre class="prettyprint linenums"> #include "com/foo/bar.h" @@ -1004,7 +1004,7 @@ int main(int argc, char **argv) return result; }</pre></div> - + <p> <tt>MyApp</tt> begins by including log4cxx headers. It then defines a static logger variable with the name <tt>MyApp</tt> @@ -1012,13 +1012,13 @@ int main(int argc, char **argv) class. </p> - + <p> <tt>MyApp</tt> uses the <tt>Bar</tt> class defined in header file <tt>com/foo/bar.h</tt>. </p> - + <div> <pre class="prettyprint linenums"> // file com/foo/bar.h @@ -1035,7 +1035,7 @@ namespace com { } }</pre></div> - + <div> <pre class="prettyprint linenums"> // file bar.cpp @@ -1050,7 +1050,7 @@ void Bar::doIt() { LOG4CXX_DEBUG(logger, "Did it again!") }</pre></div> - + <p> The invocation of the <a href="apidocs/classlog4cxx_1_1_basic_configurator.html#a4f96a09e1372664e3556ce94ace4a70c">BasicConfigurator::configure</a> method creates a rather simple log4cxx setup. This method is hardwired @@ -1060,25 +1060,25 @@ void Bar::doIt() { to the pattern "%-4r [%t] %-5p %c %x - %m%n". </p> - + <p> Note that by default, the root logger is assigned to <tt>Level::getDebug()</tt>. </p> - + <p> The output of MyApp is: </p> - + <div> <pre class="prettyprint linenums"> 0 [12345] INFO MyApp - Entering application. 36 [12345] DEBUG com.foo.Bar - Did it again! 51 [12345] INFO MyApp - Exiting application.</pre></div> - + <p> The previous example always outputs the same log information. Fortunately, it is easy to modify <tt>MyApp</tt> so that the log @@ -1086,7 +1086,7 @@ void Bar::doIt() { version. </p> - + <div> <pre class="prettyprint linenums"> // file MyApp2.cpp @@ -1134,20 +1134,20 @@ int main(int argc, char **argv) return result; }</pre></div> - + <p> This version of <tt>MyApp</tt> instructs <tt>PropertyConfigurator</tt> to parse a configuration file and set up logging accordingly. </p> - + <p> Here is a sample configuration file that results in exactly same output as the previous <tt>BasicConfigurator</tt> based example. </p> - + <div> <pre class="prettyprint linenums"> # Set root logger level to DEBUG and its only appender to A1. @@ -1160,19 +1160,19 @@ log4j.appender.A1=org.apache.log4j.Conso log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n</pre></div> - + <p> It can be noticed that the PropertyConfigurator file format is the same as log4j. </p> - + <p> Suppose we are no longer interested in seeing the output of any component belonging to the <tt>com::foo</tt> package. The following configuration file shows one possible way of achieving this. </p> - + <div> <pre class="prettyprint linenums"> log4j.rootLogger=DEBUG, A1 @@ -1185,18 +1185,18 @@ log4j.appender.A1.layout.ConversionPatte # Print only messages of level WARN or above in the package com.foo. <b>log4j.logger.com.foo=WARN</b></pre></div> - + <p> The output of <tt>MyApp</tt> configured with this file is shown below. </p> - + <div> <pre class="prettyprint linenums"> <b>2000-09-07 14:07:41,508</b> [12345] INFO MyApp - Entering application. <b>2000-09-07 14:07:41,529</b> [12345] INFO MyApp - Exiting application.</pre></div> - + <p> As the logger <tt>com.foo.Bar</tt> does not have an assigned level, it inherits its level from <tt>com.foo</tt>, which @@ -1206,12 +1206,12 @@ log4j.appender.A1.layout.ConversionPatte request is suppressed. </p> - + <p> Here is another configuration file that uses multiple appenders. </p> - + <div> <pre class="prettyprint linenums"> log4j.rootLogger=debug, <b>stdout, R</b> @@ -1232,20 +1232,20 @@ log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n</pre></div> - + <p> Calling the enhanced MyApp with the this configuration file will output the following on the console. </p> - + <div> <pre class="prettyprint linenums"> INFO [12345] <b>(MyApp2.cpp:31)</b> - Entering application. DEBUG [12345] (Bar.h:16) - Doing it again! INFO [12345] (MyApp2.cpp:34) - Exiting application.</pre></div> - + <p> In addition, as the root logger has been allocated a second appender, output will also be directed to the <tt>example.log</tt> @@ -1254,7 +1254,7 @@ INFO [12345] (MyApp2.cpp:34) - Exiting a automatically moved to <tt>example.log.1</tt>. </p> - + <p> Note that to obtain these different logging behaviors we did not need to recompile code. We could just as easily have logged to a UNIX @@ -1265,10 +1265,10 @@ INFO [12345] (MyApp2.cpp:34) - Exiting a </p> </div> - + <div class="section"> <h2>Default Initialization Procedure<a name="Default_Initialization_Procedure"></a></h2> - + <p> The log4cxx library does not make any assumptions about its environment. In particular, there are no default log4cxx @@ -1277,16 +1277,16 @@ INFO [12345] (MyApp2.cpp:34) - Exiting a automatically configure log4cxx. </p> - + <p> The exact default initialization algorithm is defined as follows: </p> - + <ol style="list-style-type: decimal"> - + <li> - + <p> Set the configurationOptionStr string variable to the value of the <b>LOG4CXX_CONFIGURATION</b> environment variable if set, otherwise @@ -1298,9 +1298,9 @@ INFO [12345] (MyApp2.cpp:34) - Exiting a If configurationOptionStr has not been set, then disable logging. </p> </li> - + <li> - + <p> Unless a custom configurator is specified using the <b>LOG4CXX_CONFIGURATOR_CLASS</b> or <b>log4j.configuratorClass</b> @@ -1315,10 +1315,10 @@ INFO [12345] (MyApp2.cpp:34) - Exiting a </ol> </div> - + <div class="section"> <h2>Nested Diagnostic Contexts<a name="Nested_Diagnostic_Contexts"></a></h2> - + <p> Most real-world systems have to deal with multiple clients simultaneously. In a typical multithreaded implementation of such a @@ -1330,7 +1330,7 @@ INFO [12345] (MyApp2.cpp:34) - Exiting a increases the management overhead of logging. </p> - + <p> A lighter technique is to uniquely stamp each log request initiated from the same client interaction. Neil Harrison described this method @@ -1339,14 +1339,14 @@ INFO [12345] (MyApp2.cpp:34) - Exiting a and F. Buschmann (Addison-Wesley, 1997). </p> - + <p> To uniquely stamp each request, the user pushes contextual information into the NDC, the abbreviation of <i>Nested Diagnostic Context</i>. The NDC class is shown below. </p> - + <div> <pre class="prettyprint linenums"> namespace log4cxx { @@ -1365,7 +1365,7 @@ namespace log4cxx { } }</pre></div> - + <p> The NDC is managed per thread as a <i>stack</i> of contextual information. Note that all methods of the <tt>log4cxx::NDC</tt> @@ -1379,7 +1379,7 @@ namespace log4cxx { approach commands extensive changes in the code. </p> - + <p> To illustrate this point, let us take the example of a servlet delivering content to numerous clients. The servlet can build the NDC @@ -1394,7 +1394,7 @@ namespace log4cxx { exercised during the client's request. </p> - + <p> Nevertheless, some sophisticated applications, such as virtual hosting web servers, must log differently depending on the virtual @@ -1405,10 +1405,10 @@ namespace log4cxx { </p> </div> - + <div class="section"> <h2>Performance<a name="Performance"></a></h2> - + <p> One of the often-cited arguments against logging is its computational cost. This is a legitimate concern as even moderately @@ -1417,21 +1417,21 @@ namespace log4cxx { claims to be fast and flexible: speed first, flexibility second. </p> - + <p> The user should be aware of the following performance issues. </p> - + <ol style="list-style-type: decimal"> - + <li> - + <p> <b>Logging performance when logging is turned off.</b> </p> - + <p> When logging is turned off entirely or just for a set of levels, the cost of a log request consists of a method @@ -1441,14 +1441,14 @@ namespace log4cxx { </p> </li> - + <li> - + <p> <b>The performance of deciding whether to log or not to log when logging is turned on.</b> </p> - + <p> This is essentially the performance of walking the logger hierarchy. When logging is turned on, log4cxx still needs to compare @@ -1459,7 +1459,7 @@ namespace log4cxx { ancestors. </p> - + <p> There has been a serious effort to make this hierarchy walk to be as fast as possible. For example, child loggers link only to @@ -1471,20 +1471,20 @@ namespace log4cxx { hierarchies. </p> - + <p> The cost of walking the hierarchy is typically 3 times slower than when logging is turned off entirely. </p> </li> - + <li> - + <p> <b>Actually outputting log messages</b> </p> - + <p> This is the cost of formatting the log output and sending it to its target destination. Here again, a serious effort was made to @@ -1495,10 +1495,10 @@ namespace log4cxx { </ol> </div> - + <div class="section"> <h2>Conclusions<a name="Conclusions"></a></h2> - + <p> Apache Log4cxx is a popular logging package written in C++. One of its distinctive features is the notion of inheritance in loggers. Using @@ -1507,7 +1507,7 @@ namespace log4cxx { logged output and minimize the cost of logging. </p> - + <p> One of the advantages of the log4cxx API is its manageability. Once the log statements have been inserted into the code, they can be @@ -1518,7 +1518,7 @@ namespace log4cxx { performance cost. </p> </div> - + </td> </tr>