📄 streams.doc22.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="../../wrs.css"><title>WindNet STREAMS Debugging WindNet STREAMS for Tornado </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="../../icons/contents.gif"></a><a href="streams.doc21.html"><img border="0" alt="[Prev]" src="../../icons/prev.gif"></a><a href="streams.doc23.html"><img border="0" alt="[Next]" src="../../icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="80258" class="autotag">5.2 STREAMS Error and Trace Logging</a></i></h3></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="80534" class="autotag"> </a>WindNet STREAMS provides two utilities, <b class="keyword">strace</b> and <b class="keyword">strerr</b>, as well as the <b class="routine"><i class="routine">strlog</i></b><b>( )</b>routine for debugging and administering STREAMS modules and drivers. Any module or driver in any stream can call the STREAMS logging function, <b class="routine"><i class="routine">strlog</i></b><b>( )</b>, which sends formatted text to the error logger, <b class="keyword">strerr</b>, or the trace logger, <b class="keyword">strace</b>, or both.</p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="80429" class="autotag">5.2.1 <b class="keyword">strace</b> Utility</a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="91782" class="autotag"> </a>The WindNet STREAMS <b class="keyword">strace</b> utility can be called with or without arguments. When it is called without any arguments, it prints all event trace messages from all drivers and modules in the system to a file, <b class="file">streams.log</b>, in the directory specified by the configuration constant <b>STREAMS_STRACE_OUTPUT_DIR</b> in <b class="file">configAll.h</b>. The <b class="keyword">strace</b> utility obtains these messages from the STREAMS log driver. (For more information about configuring this utility into VxWorks, see <a href="streams.doc25.html#72373"><i class="title">§6.1 Configuring VxWorks for WindNet STREAMS</i></a>.)</p><p class="Body"><a name="87908" class="autotag"> </a>If you call <b class="keyword">strace</b> with arguments, you must use a set of triplets--<font face="Palatino, serif"><i class="textVariable">mid</i></font>, <font face="Palatino, serif"><i class="textVariable">sid</i></font> and <font face="Palatino, serif"><i class="textVariable">level</i></font>, in that order--as shown in the following command:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="87916" class="autotag">-> sp strace "<mid> <sid> <level>"</a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="81168" class="autotag"> </a>Each triplet indicates that tracing messages are to be received from the module specified by <font face="Palatino, serif"><i class="textVariable">mid</i></font> (module ID), by <font face="Palatino, serif"><i class="textVariable">sid</i></font> (sub-ID, usually indicating a minor device number), and by <font face="Palatino, serif"><i class="textVariable">level</i></font> (a tracing priority level equal to or less than the specified value). The token <font face="Palatino, serif"><i class="textVariable">all</i></font> is substituted for <font face="Palatino, serif"><i class="textVariable">mid</i></font>, <font face="Palatino, serif"><i class="textVariable">sid</i></font>, and <font face="Palatino, serif"><i class="textVariable">level</i></font> when you want to remove restrictions for that attribute. </p><p class="Body"><a name="87923" class="autotag"> </a>If the module ID is provided to <b class="keyword">strace</b>, then <b class="keyword">strace</b> output is sent to the file <font face="Palatino, serif"><i class="textVariable">module-id</i></font><b class="file">.log</b> in <b>STREAMS_STRACE_OUTPUT_DIR</b>. The module ID is a unique identification number that identifies the STREAMS driver or module in the STREAMS subsystem. It is obtained from the <b>module-id</b> field in the <b>module_info</b> structure. Every STREAMS driver or module has a <b>module_info</b> structure.</p></dd></dl></dd></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="81230" class="autotag">Example: </a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="81530" class="autotag"> </a>The following command traces all the trace messages from the STREAMS driver or module which has its module ID as <font face="Palatino, serif"><i class="textVariable">mid</i></font><b>,</b> for all sub-IDs, and all trace levels:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="81231" class="autotag">-> sp strace "<mid> all all"</a></pre></dd></dl><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="80434" class="autotag">Example:</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="81536" class="autotag"> </a>The following command traces the trace messages from the STREAMS driver or module that has a module ID of 5232, a sub ID of 0, and a tracing level of 1:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80555" class="autotag">-> sp strace "5232 0 1"</a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="80436" class="autotag"> </a>Sample output from this <b class="keyword">strace</b> call:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80437" class="autotag"><tt><font class="output" color="#55AA55">1 12:00:00 1 ... 5232 0 loop: This is a sample strlog output</font></tt></a><a name="80438" class="autotag"><tt><font class="output" color="#55AA55">2 12:00:01 1 ... 5232 0 loop: From VxWorks STREAMS</font></tt></a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="80439" class="autotag"> </a>The fields in <b class="keyword">strace</b> output, as shown above, are the message sequence number, timestamp, tracing level, module ID, sub-ID, module name, and the actual message. </p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="80441" class="autotag">5.2.2 <b class="keyword">strerr</b> Utility </a></i></h4></font><dl class="margin"><dd><dl class="margin"><dd><p class="Body"><a name="81317" class="autotag"> </a>The <b class="keyword">strerr</b> utility prints error messages from all the STREAMS drivers and modules in a system. The resulting <b class="file">error.log</b> file resides in the directory specified by the configuration constant <b>STREAMS_STRERR_OUTPUT_DIR</b> in <b class="file">configAll.h</b>. (For information about configuring this utility into VxWorks, see <a href="streams.doc25.html#72373"><i class="title">§6.1 Configuring VxWorks for WindNet STREAMS</i></a>.) The <b class="keyword">strerr</b> utility pursues only comprehensive traces of all error messages in a system; it <i class="emphasis">cannot</i> be used for traces from a single STREAMS driver or module. </p><p class="Body"><a name="80442" class="autotag"> </a>The format of an error message provided by <b class="keyword">strerr</b> is as follows:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80443" class="autotag"><tt><font class="output" color="#55AA55"><seq> <time> <ticks> <flags> <mid> <sid> <text></font></tt></a><a name="80444" class="autotag"><tt><font class="output" color="#55AA55"><seq> error sequence number</font></tt></a><a name="80445" class="autotag"><tt><font class="output" color="#55AA55"><time> time of message</font></tt></a><a name="80446" class="autotag"><tt><font class="output" color="#55AA55"><ticks> time of message in machine ticks since boot</font></tt></a><a name="80447" class="autotag"><tt><font class="output" color="#55AA55"><flags> </font></tt></a><a name="80448" class="autotag"><tt><font class="output" color="#55AA55">T: the message was also sent to a tracing tasks</font></tt></a><a name="80449" class="autotag"><tt><font class="output" color="#55AA55">F: Indicates a fatal error</font></tt></a><a name="80450" class="autotag"><tt><font class="output" color="#55AA55"><mid> Module-Id number of source</font></tt></a><a name="80451" class="autotag"><tt><font class="output" color="#55AA55"><sid> Sub-Id number of source</font></tt></a><a name="80452" class="autotag"><tt><font class="output" color="#55AA55"><text> formatted text of the error message </font></tt></a></pre></dd></dl></dd></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="80453" class="autotag">Example</a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="81524" class="autotag"> </a>The following command traces all the error messages from all STREAMS drivers and modules in the system and appends them to the log file <b class="file">error.log</b>:</p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80557" class="autotag">-> sp strerr </a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="80455" class="autotag"> </a>Sample output from <b class="keyword">strerr</b>:<b class="keyword"></b></p></dd></dl><dl class="margin"><dd><pre class="Code"><a name="80456" class="autotag"><tt><font class="output" color="#55AA55">1 00:00:43 3736781 TF 5232 0 loop: "This sample message has the FATAL bit set" </font></tt></a></pre></dd></dl><dl class="margin"><dd><p class="Body"><a name="80808" class="autotag"> </a>The fields in <b class="keyword">strerr</b> output, as shown above, are the message sequence number (1), timestamp (00:00:43), time of message in machine ticks (3736781) , flags (TF), module ID (5232), sub-ID (0), and text.</p></dd></dl></dd></dl><font face="Helvetica, sans-serif" class="sans">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -