blob: a13658d804d1ca39373f38379f44aa5490c9c635 [file] [log] [blame]
<html>
<head>
<title>
log4cxx - Documentation
</title>
<link href="../css/doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76">
<!-- START Header table -->
<table border="0" cellspacing="0" width="90%">
<!-- TOP IMAGE -->
<tr>
<td colspan="2">
<a href="http://logging.apache.org">
<img src="http://logging.apache.org/images/ls-logo.jpg" align="left" border="0"/>
</a>
</td>
</tr>
</table>
<!-- END Header table -->
<!-- START main table -->
<table id="main" border="0" width="90%" cellspacing="2" cellpadding="0">
<tr><td colspan="2">
<hr noshade="" size="1"/>
</td></tr>
<tr>
<!-- LEFT SIDE NAVIGATION -->
<td id="navbar" valign="top">
<!-- ============================================================ -->
<table id="navbar" border="0" cellspacing="0" cellpadding="0">
<tr >
<td class="navbarHeader" nowrap="true">
<strong>Apache</strong>
</td>
</tr>
<tr><td class="navbarItem"><small> <a href="http://www.apache.org">Apache Home</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="http://logging.apache.org/">Logging Services</a>
</small></td></tr>
<tr >
<td class="navbarHeader" nowrap="true">
<strong>log4cxx project</strong>
</td>
</tr>
<tr><td class="navbarItem"><small> <a href="../index.html">About</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../news.html">News</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../team.html">Team</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../manual/index.html">Documentation</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../performance.html">Performance</a>
</small></td></tr>
<tr><td class="navbarItem"><small> <a href="../download.html">Download</a>
</small></td></tr>
</table>
</td>
<td id="mainContents" align="left" valign="top">
<hr>
<!-- Generated by Doxygen 1.3.5 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>TTCCLayout Class Reference</h1>Inheritance diagram for TTCCLayout:<p><center><img src="classlog4cxx_1_1TTCCLayout__inherit__graph.png" border="0" usemap="#TTCCLayout__inherit__map" alt="Inheritance graph"></center>
<map name="TTCCLayout__inherit__map">
<area href="classlog4cxx_1_1helpers_1_1DateLayout.html" shape="rect" coords="70,242,147,266" alt="">
<area href="classlog4cxx_1_1Layout.html" shape="rect" coords="84,168,134,191" alt="">
<area href="classlog4cxx_1_1spi_1_1OptionHandler.html" shape="rect" coords="6,93,102,117" alt="">
<area href="classlog4cxx_1_1helpers_1_1Object.html" shape="rect" coords="84,18,134,42" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectImpl.html" shape="rect" coords="126,93,201,117" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for TTCCLayout:<p><center><img src="classlog4cxx_1_1TTCCLayout__coll__graph.png" border="0" usemap="#TTCCLayout__coll__map" alt="Collaboration graph"></center>
<map name="TTCCLayout__coll__map">
<area href="classlog4cxx_1_1helpers_1_1DateLayout.html" shape="rect" coords="175,277,253,301" alt="">
<area href="classlog4cxx_1_1Layout.html" shape="rect" coords="138,187,189,210" alt="">
<area href="classlog4cxx_1_1spi_1_1OptionHandler.html" shape="rect" coords="6,96,102,120" alt="">
<area href="classlog4cxx_1_1helpers_1_1Object.html" shape="rect" coords="90,19,141,43" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectImpl.html" shape="rect" coords="126,96,201,120" alt="">
<area href="classlog4cxx_1_1helpers_1_1DateFormat.html" shape="rect" coords="217,187,297,210" alt="">
<area href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html" shape="rect" coords="225,96,297,120" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classlog4cxx_1_1TTCCLayout-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a0">TTCCLayout</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a1">TTCCLayout</a> (const String &amp;dateFormatType)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a2">setThreadPrinting</a> (bool threadPrinting)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a3">getThreadPrinting</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a4">setCategoryPrefixing</a> (bool categoryPrefixing)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a5">getCategoryPrefixing</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a6">setContextPrinting</a> (bool contextPrinting)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a7">getContextPrinting</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a8">setFilePrinting</a> (bool filePrinting)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a9">getFilePrinting</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a10">format</a> (ostream &amp;output, const <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">spi::LoggingEventPtr</a> &amp;event) const </td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classlog4cxx_1_1TTCCLayout.html#a11">ignoresThrowable</a> () const </td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
TTCC layout format consists of time, thread, category and nested diagnostic context information, hence the name.<p>
Each of the four fields can be individually enabled or disabled. The time format depends on the <code>DateFormat</code> used.<p>
Here is an example <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> output with the <a class="el" href="classlog4cxx_1_1helpers_1_1RelativeTimeDateFormat.html">RelativeTimeDateFormat</a>.<p>
<pre><div>
176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
225 [main] INFO examples.SortAlgo - Entered the sort method.
262 [main] DEBUG examples.SortAlgo.OUTER i=1 - Outer loop.
276 [main] DEBUG examples.SortAlgo.SWAP i=1 j=0 - Swapping intArray[0] = 1 and intArray[1] = 0
290 [main] DEBUG examples.SortAlgo.OUTER i=0 - Outer loop.
304 [main] INFO examples.SortAlgo.DUMP - Dump of interger array:
317 [main] INFO examples.SortAlgo.DUMP - Element [0] = 0
331 [main] INFO examples.SortAlgo.DUMP - Element [1] = 1
343 [main] INFO examples.Sort - The next log statement should be an error message.
346 [main] ERROR examples.SortAlgo.DUMP - Tried to dump an uninitialized array.
467 [main] INFO examples.Sort - Exiting main method.
</pre></div><p>
The first field is the number of milliseconds elapsed since the start of the program. The second field is the thread outputting the log statement. The third field is the level, the fourth field is the category to which the statement belongs.<p>
The fifth field (just before the '-') is the nested diagnostic context. Note the nested diagnostic context may be empty as in the first two statements. The text after the '-' is the message of the statement.<p>
<b>WARNING</b> Do not use the same <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> instance from within different appenders. The <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> is not thread safe when used in his way. However, it is perfectly safe to use a <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> instance from just one appender.<p>
<a class="el" href="classlog4cxx_1_1PatternLayout.html">PatternLayout</a> offers a much more flexible alternative.
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="a0" doxytag="log4cxx::TTCCLayout::TTCCLayout" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Instantiate a <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> object with <a class="el" href="classlog4cxx_1_1helpers_1_1RelativeTimeDateFormat.html">RelativeTimeDateFormat</a> as the date formatter in the local time zone. </td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="log4cxx::TTCCLayout::TTCCLayout" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const String &amp;&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>dateFormatType</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Instantiate a <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> object using the local time zone. The DateFormat used will depend on the <code>dateFormatType</code>. <p>
This constructor just calls the <a class="el" href="classlog4cxx_1_1helpers_1_1DateLayout.html#a4">DateLayout::setDateFormat</a> method. </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a10" doxytag="log4cxx::TTCCLayout::format" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void format </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">ostream &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>output</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="classlog4cxx_1_1helpers_1_1ObjectPtrT.html">spi::LoggingEventPtr</a> &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>event</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
In addition to the level of the statement and message, this function writes to the ouput stream time, thread, category and <a class="el" href="classlog4cxx_1_1NDC.html">NDC</a> information.<p>
Time, thread, category and diagnostic context are printed depending on options.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign=top><em>output</em>&nbsp;</td><td></td></tr>
<tr><td valign=top><em>event</em>&nbsp;</td><td></td></tr>
</table>
</dl>
<p>
Implements <a class="el" href="classlog4cxx_1_1Layout.html#a1">Layout</a>. </td>
</tr>
</table>
<a class="anchor" name="a5" doxytag="log4cxx::TTCCLayout::getCategoryPrefixing" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool getCategoryPrefixing </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Returns value of the <b>CategoryPrefixing</b> option. </td>
</tr>
</table>
<a class="anchor" name="a7" doxytag="log4cxx::TTCCLayout::getContextPrinting" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool getContextPrinting </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Returns value of the <b>ContextPrinting</b> option. </td>
</tr>
</table>
<a class="anchor" name="a9" doxytag="log4cxx::TTCCLayout::getFilePrinting" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool getFilePrinting </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Returns value of the <b>ContextPrinting</b> option. </td>
</tr>
</table>
<a class="anchor" name="a3" doxytag="log4cxx::TTCCLayout::getThreadPrinting" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> bool getThreadPrinting </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap> const<code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Returns value of the <b>ThreadPrinting</b> option. </td>
</tr>
</table>
<a class="anchor" name="a11" doxytag="log4cxx::TTCCLayout::ignoresThrowable" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> virtual bool ignoresThrowable </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap> const<code> [inline, virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
The <a class="el" href="classlog4cxx_1_1TTCCLayout.html">TTCCLayout</a> does not handle the throwable contained within <a class="el" href="classlog4cxx_1_1spi_1_1LoggingEvent.html">LoggingEvents</a>. Thus, it returns <code>true</code>.
<p>
Implements <a class="el" href="classlog4cxx_1_1Layout.html#a5">Layout</a>. </td>
</tr>
</table>
<a class="anchor" name="a4" doxytag="log4cxx::TTCCLayout::setCategoryPrefixing" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void setCategoryPrefixing </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">bool&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>categoryPrefixing</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
The <b>CategoryPrefixing</b> option specifies whether <a class="el" href="classlog4cxx_1_1Logger.html">Logger</a> name is part of log output or not. This is true by default. </td>
</tr>
</table>
<a class="anchor" name="a6" doxytag="log4cxx::TTCCLayout::setContextPrinting" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void setContextPrinting </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">bool&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>contextPrinting</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
The <b>ContextPrinting</b> option specifies log output will include the nested context information belonging to the current thread. This is true by default. </td>
</tr>
</table>
<a class="anchor" name="a8" doxytag="log4cxx::TTCCLayout::setFilePrinting" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void setFilePrinting </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">bool&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>filePrinting</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
The <b>FilePrinting</b> option specifies log output will include the file and the line where the log statement was written. </td>
</tr>
</table>
<a class="anchor" name="a2" doxytag="log4cxx::TTCCLayout::setThreadPrinting" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void setThreadPrinting </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">bool&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>threadPrinting</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
The <b>ThreadPrinting</b> option specifies whether the name of the current thread is part of log output or not. This is true by default. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li>ttcclayout.h<li>ttcclayout.cpp</ul>
</td>
</tr>
<!-- FOOTER -->
<tr><td colspan="2">
<hr noshade="" size="1"/>
</td></tr>
<tr><td colspan="2">
<div align="center"><font color="#525D76" size="-1"><em>
Copyright &#169; 1999-2004, Apache Software Foundation
</em></font></div>
</td></tr>
</table>
<!-- END main table -->
</body>
</html>
<!-- end the processing -->