1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>log4cpp: log4cpp::NDC Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<div class="nav">
<a class="el" href="namespacelog4cpp.html">log4cpp</a>::<a class="el" href="classlog4cpp_1_1NDC.html">NDC</a></div>
<h1>log4cpp::NDC Class Reference</h1>The <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> class implements <em>nested diagnostic contexts</em> as defined by Neil Harrison in the article "Patterns for Logging Diagnostic Messages" part of the book "<em>Pattern Languages of Program Design 3</em>" edited by Martin et al.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="NDC_8hh-source.html">NDC.hh</a>></code>
<p>
<a href="classlog4cpp_1_1NDC-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef std::vector< <a class="el" href="structlog4cpp_1_1NDC_1_1DiagnosticContext.html">DiagnosticContext</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a0">NDC</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a1">~NDC</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a2">_clear</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a3">_cloneStack</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a4">_get</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a5">_getDepth</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a6">_inherit</a> (<a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> *stack)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a7">_pop</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a8">_push</a> (const std::string &message)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#a9">_setMaxDepth</a> (int maxDepth)</td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e0">clear</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Clear any nested disgnostic information if any. <a href="#e0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e1">cloneStack</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Clone the diagnostic context for the current thread. <a href="#e1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e2">get</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the current diagnostic context string. <a href="#e2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e3">getDepth</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Get the current nesting depth of this diagnostic context. <a href="#e3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e4">inherit</a> (<a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> *stack)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e5">pop</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Clients should call this method before leaving a diagnostic context. <a href="#e5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e6">push</a> (const std::string &message)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Push new diagnostic context information for the current thread. <a href="#e6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e7">setMaxDepth</a> (int maxDepth)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the maximum nesting depth for the current <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a>. <a href="#e7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#e8">getNDC</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> for the current thread. <a href="#e8"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classlog4cpp_1_1NDC.html#o0">_stack</a></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structlog4cpp_1_1NDC_1_1DiagnosticContext.html">DiagnosticContext</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> class implements <em>nested diagnostic contexts</em> as defined by Neil Harrison in the article "Patterns for Logging Diagnostic Messages" part of the book "<em>Pattern Languages of Program Design 3</em>" edited by Martin et al.
<p>
A Nested Diagnostic Context, or <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> in short, is an instrument to distinguish interleaved log output from different sources. Log output is typically interleaved when a server handles multiple clients near-simulatanously.<p>
Interleaved log output can still be meaningful if each log entry from different contexts had a distinctive stamp. This is where NDCs come into play.<p>
<em><b>Note that NDCs are managed on a per thread basis</b></em>. <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> operations such as <code>push</code>, <code> pop</code>, <code>clear</code>, <code>getDepth</code> and <code> setMaxDepth</code> affect the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> of the <em>current</em> thread only. NDCs of other threads remain unaffected.<p>
To build an <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> one uses the <code>push</code> operation. Simply put,<p>
<ul>
<li>
Contexts can be nested.<p>
<p>
</li>
<li>
When entering a context, call <code><a class="el" href="classlog4cpp_1_1NDC.html#e6">NDC.push</a></code>. As a side effect, if there is no nested diagnostic context for the current thread, this method will create it.<p>
<p>
</li>
<li>
When leaving a context, call <code><a class="el" href="classlog4cpp_1_1NDC.html#e5">NDC.pop</a></code>. </li>
</ul>
<p>
There is no penalty for forgetting to match each <code>push</code> operation with a corresponding <code>pop</code>, except the obvious mismatch between the real application context and the context set in the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a>.<p>
Custom Layouts may include the nested diagnostic context for the current thread in log messages, without any user intervention. Hence, even if a server is serving multiple clients simultaneously, the logs emanating from the same code (belonging to the same category) can still be distinguished because each client request will have a different <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> tag.<p>
<em>Unfortunately, unlike Java, C++ does not have platform independent multithreading support. Therefore, currently <a class="el" href="namespacelog4cpp.html">log4cpp</a> is not multithread aware, it implicitly assumes only one thread exists, the main process thread. </em>
<p>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="w0" doxytag="log4cpp::NDC::ContextStack"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">typedef std::vector<<a class="el" href="structlog4cpp_1_1NDC_1_1DiagnosticContext.html">DiagnosticContext</a>> <a class="el" href="classlog4cpp_1_1NDC.html#w0">log4cpp::NDC::ContextStack</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="a0" doxytag="log4cpp::NDC::NDC"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">log4cpp::NDC::NDC </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="log4cpp::NDC::~NDC"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">log4cpp::NDC::~NDC </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a2" doxytag="log4cpp::NDC::_clear"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::_clear </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a3" doxytag="log4cpp::NDC::_cloneStack"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1NDC.html#w0">NDC::ContextStack</a> * log4cpp::NDC::_cloneStack </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="log4cpp::NDC::_get"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">const std::string & log4cpp::NDC::_get </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a5" doxytag="log4cpp::NDC::_getDepth"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">size_t log4cpp::NDC::_getDepth </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="log4cpp::NDC::_inherit"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::_inherit </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> * </td>
<td class="mdname1" valign="top" nowrap> <em>stack</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a7" doxytag="log4cpp::NDC::_pop"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">std::string log4cpp::NDC::_pop </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a8" doxytag="log4cpp::NDC::_push"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::_push </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname1" valign="top" nowrap> <em>message</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="a9" doxytag="log4cpp::NDC::_setMaxDepth"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::_setMaxDepth </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">int </td>
<td class="mdname1" valign="top" nowrap> <em>maxDepth</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="e0" doxytag="log4cpp::NDC::clear"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::clear </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Clear any nested disgnostic information if any.
<p>
This method is useful in cases where the same thread can be potentially used over and over in different unrelated contexts.<p>
This method is equivalent to calling the <code>setMaxDepth</code> method with a zero <code>maxDepth</code> argument. </td>
</tr>
</table>
<a class="anchor" name="e1" doxytag="log4cpp::NDC::cloneStack"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1NDC.html#w0">NDC::ContextStack</a> * log4cpp::NDC::cloneStack </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Clone the diagnostic context for the current thread.
<p>
Internally a diagnostic context is represented as a stack. A given thread can supply the stack (i.e. diagnostic context) to a child thread so that the child can inherit the parent thread's diagnostic context.<p>
The child thread uses the <code>inherit</code> method to inherit the parent's diagnostic context.<p>
<dl compact><dt><b>Returns:</b></dt><dd>Stack A clone of the current thread's diagnostic context. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="e2" doxytag="log4cpp::NDC::get"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">const std::string & log4cpp::NDC::get </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Get the current diagnostic context string.
<p>
<dl compact><dt><b>Returns:</b></dt><dd>the context string. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="e3" doxytag="log4cpp::NDC::getDepth"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">size_t log4cpp::NDC::getDepth </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Get the current nesting depth of this diagnostic context.
<p>
<dl compact><dt><b>Returns:</b></dt><dd>the nesting depth </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="e8" doxytag="log4cpp::NDC::getNDC"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> & log4cpp::NDC::getNDC </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Return the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> for the current thread.
<p>
<dl compact><dt><b>Returns:</b></dt><dd>the <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a> for the current thread </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="e4" doxytag="log4cpp::NDC::inherit"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::inherit </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> * </td>
<td class="mdname1" valign="top" nowrap> <em>stack</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="e5" doxytag="log4cpp::NDC::pop"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">std::string log4cpp::NDC::pop </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Clients should call this method before leaving a diagnostic context.
<p>
The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned.<p>
<dl compact><dt><b>Returns:</b></dt><dd>String The innermost diagnostic context. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="e6" doxytag="log4cpp::NDC::push"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::push </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const std::string & </td>
<td class="mdname1" valign="top" nowrap> <em>message</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Push new diagnostic context information for the current thread.
<p>
The contents of the <code>message</code> parameter is determined solely by the client.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>message</em> </td><td>The new diagnostic context information. </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="e7" doxytag="log4cpp::NDC::setMaxDepth"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void log4cpp::NDC::setMaxDepth </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">int </td>
<td class="mdname1" valign="top" nowrap> <em>maxDepth</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Set the maximum nesting depth for the current <a class="el" href="classlog4cpp_1_1NDC.html">NDC</a>.
<p>
Curently NDCs do not enforce a maximum depth and consequentially this method has no effect. <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>maxDepth</em> </td><td>the maximum nesting depth </td></tr>
</table>
</dl>
</td>
</tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="o0" doxytag="log4cpp::NDC::_stack"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="classlog4cpp_1_1NDC.html#w0">ContextStack</a> <a class="el" href="classlog4cpp_1_1NDC.html#o0">log4cpp::NDC::_stack</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
</td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="NDC_8hh-source.html">NDC.hh</a><li><a class="el" href="NDC_8cpp.html">NDC.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Fri Jul 29 14:12:28 2005 for log4cpp by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|