isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

logger.html (13374B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>logger</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/localedef.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/logname.html" accesskey="N">Next
     19 &gt;&gt;&gt;</a></td>
     20 </tr>
     21 </table>
     22 <hr align="left" width="100%"></div>
     23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     24 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     25 IEEE Std 1003.1-2024<br>
     26 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     27 <hr size="2" noshade>
     28 <a name="top" id="top"></a> <a name="logger" id="logger"></a> <a name="tag_20_70" id="tag_20_70"></a><!-- logger -->
     29 <h4 class="mansect"><a name="tag_20_70_01" id="tag_20_70_01"></a>NAME</h4>
     30 <blockquote>logger — log messages</blockquote>
     31 <h4 class="mansect"><a name="tag_20_70_02" id="tag_20_70_02"></a>SYNOPSIS</h4>
     32 <blockquote class="synopsis">
     33 <p><code><tt>logger</tt> <b>[</b><tt>-i</tt><b>] [</b><tt>-f</tt> <i>file</i><b>] [</b><tt>-p</tt> <i>priority</i><b>] [</b><tt>-t</tt>
     34 <i>tag</i><b>] [</b><tt>string...</tt><b>]</b></code></p>
     35 </blockquote>
     36 <h4 class="mansect"><a name="tag_20_70_03" id="tag_20_70_03"></a>DESCRIPTION</h4>
     37 <blockquote>
     38 <p>The <i>logger</i> utility shall send messages to an implementation-defined logging facility, which may log them in an
     39 implementation-defined system log, write them to the system console, forward them to a list of users, or forward them to the
     40 logging facility on another host over the network. Each logged message shall include a message header and a message body. The
     41 message header shall contain at least a timestamp and a tag string.</p>
     42 <p>If one or more <i>string</i> operands are specified, they shall be logged; otherwise, the message bodies to be logged shall be
     43 read from standard input if no <b>-f</b> option is specified, or from the specified file if the <b>-f</b> option is present.</p>
     44 <p>It is implementation-defined whether messages written in locales other than the POSIX locale are effective.</p>
     45 </blockquote>
     46 <h4 class="mansect"><a name="tag_20_70_04" id="tag_20_70_04"></a>OPTIONS</h4>
     47 <blockquote>
     48 <p>The <i>logger</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     49 Guidelines</i></a> .</p>
     50 <p>The following options shall be supported:</p>
     51 <dl compact>
     52 <dd></dd>
     53 <dt><b>-f&nbsp;</b><i>file</i></dt>
     54 <dd>Read the log message bodies from <i>file</i> instead of standard input.</dd>
     55 <dt><b>-i</b></dt>
     56 <dd>Log the process ID of the <i>logger</i> process with each message.</dd>
     57 <dt><b>-p&nbsp;</b><i>priority</i></dt>
     58 <dd>Log the message with priority set to <i>priority</i>. The priority is specified as a <i>facility</i>.<i>level</i> pair. The
     59 following values for <i>facility</i> shall be supported:
     60 <dl compact>
     61 <dd></dd>
     62 <dt>user</dt>
     63 <dd>Messages generated by arbitrary processes.</dd>
     64 <dt>local0</dt>
     65 <dd>Reserved for local use.</dd>
     66 <dt>local1</dt>
     67 <dd>Reserved for local use.</dd>
     68 <dt>local2</dt>
     69 <dd>Reserved for local use.</dd>
     70 <dt>local3</dt>
     71 <dd>Reserved for local use.</dd>
     72 <dt>local4</dt>
     73 <dd>Reserved for local use.</dd>
     74 <dt>local5</dt>
     75 <dd>Reserved for local use.</dd>
     76 <dt>local6</dt>
     77 <dd>Reserved for local use.</dd>
     78 <dt>local7</dt>
     79 <dd>Reserved for local use.</dd>
     80 </dl>
     81 <p>The following values for <i>level</i> shall be supported:</p>
     82 <dl compact>
     83 <dd></dd>
     84 <dt>emerg</dt>
     85 <dd>A panic condition.</dd>
     86 <dt>alert</dt>
     87 <dd>A condition that should be corrected immediately, such as a corrupted system database.</dd>
     88 <dt>crit</dt>
     89 <dd>Critical conditions, such as hard device errors.</dd>
     90 <dt>err</dt>
     91 <dd>Errors.</dd>
     92 <dt>warning</dt>
     93 <dd>Warning messages.</dd>
     94 <dt>notice</dt>
     95 <dd>Conditions that are not error conditions, but that may require special handling.</dd>
     96 <dt>info</dt>
     97 <dd>Informational messages.</dd>
     98 <dt>debug</dt>
     99 <dd>Messages that contain information normally of use only when debugging a program.</dd>
    100 </dl>
    101 <p>If the <b>-p</b> option is not specified, the priority shall be <tt>user.notice</tt>.</p>
    102 </dd>
    103 <dt><b>-t&nbsp;</b><i>tag</i></dt>
    104 <dd>Use the string <i>tag</i> as the tag string in the message header. The default tag is unspecified.</dd>
    105 </dl>
    106 </blockquote>
    107 <h4 class="mansect"><a name="tag_20_70_05" id="tag_20_70_05"></a>OPERANDS</h4>
    108 <blockquote>
    109 <p>The following operand shall be supported:</p>
    110 <dl compact>
    111 <dd></dd>
    112 <dt><i>string</i></dt>
    113 <dd>One of the string arguments whose contents are concatenated together, in the order specified, separated by single &lt;space&gt;
    114 characters.</dd>
    115 </dl>
    116 </blockquote>
    117 <h4 class="mansect"><a name="tag_20_70_06" id="tag_20_70_06"></a>STDIN</h4>
    118 <blockquote>
    119 <p>The standard input shall be used if no <i>string</i> operands are specified and either the <b>-f</b> option is not specified or
    120 the <b>-f</b> option is specified with a <i>file</i> option-argument of <tt>'-'</tt> and the implementation treats the <tt>'-'</tt>
    121 as meaning standard input. Otherwise, the standard input shall not be used. See the INPUT FILES section.</p>
    122 <p>Each non-empty line shall be logged as a separate message. It is unspecified whether an empty line is also logged as a separate
    123 message.</p>
    124 </blockquote>
    125 <h4 class="mansect"><a name="tag_20_70_07" id="tag_20_70_07"></a>INPUT FILES</h4>
    126 <blockquote>
    127 <p>The input files shall be text files.</p>
    128 </blockquote>
    129 <h4 class="mansect"><a name="tag_20_70_08" id="tag_20_70_08"></a>ENVIRONMENT VARIABLES</h4>
    130 <blockquote>
    131 <p>The following environment variables shall affect the execution of <i>logger</i>:</p>
    132 <dl compact>
    133 <dd></dd>
    134 <dt><i>LANG</i></dt>
    135 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
    136 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
    137 variables used to determine the values of locale categories.)</dd>
    138 <dt><i>LC_ALL</i></dt>
    139 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    140 <dt><i>LC_CTYPE</i></dt>
    141 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    142 opposed to multi-byte characters in arguments).</dd>
    143 <dt><i>LC_MESSAGES</i></dt>
    144 <dd><br>
    145 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. (This
    146 means diagnostics from <i>logger</i> to the user or application, not diagnostic messages that the user is sending to the system
    147 administrator.)</dd>
    148 <dt><i>NLSPATH</i></dt>
    149 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    150 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    151 "0"></dd>
    152 </dl>
    153 </blockquote>
    154 <h4 class="mansect"><a name="tag_20_70_09" id="tag_20_70_09"></a>ASYNCHRONOUS EVENTS</h4>
    155 <blockquote>
    156 <p>Default.</p>
    157 </blockquote>
    158 <h4 class="mansect"><a name="tag_20_70_10" id="tag_20_70_10"></a>STDOUT</h4>
    159 <blockquote>
    160 <p>Not used.</p>
    161 </blockquote>
    162 <h4 class="mansect"><a name="tag_20_70_11" id="tag_20_70_11"></a>STDERR</h4>
    163 <blockquote>
    164 <p>The standard error shall be used only for diagnostic messages.</p>
    165 </blockquote>
    166 <h4 class="mansect"><a name="tag_20_70_12" id="tag_20_70_12"></a>OUTPUT FILES</h4>
    167 <blockquote>
    168 <p>Unspecified.</p>
    169 </blockquote>
    170 <h4 class="mansect"><a name="tag_20_70_13" id="tag_20_70_13"></a>EXTENDED DESCRIPTION</h4>
    171 <blockquote>
    172 <p>None.</p>
    173 </blockquote>
    174 <h4 class="mansect"><a name="tag_20_70_14" id="tag_20_70_14"></a>EXIT STATUS</h4>
    175 <blockquote>
    176 <p>The following exit values shall be returned:</p>
    177 <dl compact>
    178 <dd></dd>
    179 <dt>&nbsp;0</dt>
    180 <dd>Successful completion.</dd>
    181 <dt>&gt;0</dt>
    182 <dd>An error occurred.</dd>
    183 </dl>
    184 </blockquote>
    185 <h4 class="mansect"><a name="tag_20_70_15" id="tag_20_70_15"></a>CONSEQUENCES OF ERRORS</h4>
    186 <blockquote>
    187 <p>Default.</p>
    188 </blockquote>
    189 <hr>
    190 <div class="box"><em>The following sections are informative.</em></div>
    191 <h4 class="mansect"><a name="tag_20_70_16" id="tag_20_70_16"></a>APPLICATION USAGE</h4>
    192 <blockquote>
    193 <p>This utility allows logging of information for later use by a system administrator or programmer in determining why
    194 non-interactive utilities have failed. The locations of the saved messages, their format, and retention period are all unspecified.
    195 There is no method for a conforming application to read messages, once written.</p>
    196 </blockquote>
    197 <h4 class="mansect"><a name="tag_20_70_17" id="tag_20_70_17"></a>EXAMPLES</h4>
    198 <blockquote>
    199 <p>A batch application, running non-interactively, tries to read a configuration file and fails; it may attempt to notify the
    200 system administrator with:</p>
    201 <pre>
    202 <tt>logger myname: unable to read file foo. [timestamp]
    203 </tt></pre></blockquote>
    204 <h4 class="mansect"><a name="tag_20_70_18" id="tag_20_70_18"></a>RATIONALE</h4>
    205 <blockquote>
    206 <p>The standard developers believed strongly that some method of alerting administrators to errors was necessary. The obvious
    207 example is a batch utility, running non-interactively, that is unable to read its configuration files or that is unable to create
    208 or write its results file. However, the standard developers did not wish to define the format or delivery mechanisms as they have
    209 historically been (and will probably continue to be) very system-specific, as well as involving functionality clearly outside the
    210 scope of this volume of POSIX.1-2024.</p>
    211 <p>The text with <i>LC_MESSAGES</i> about diagnostic messages means diagnostics from <i>logger</i> to the user or application, not
    212 diagnostic messages that the user is sending to the system administrator.</p>
    213 <p>Multiple <i>string</i> arguments are allowed, similar to <a href="../utilities/echo.html"><i>echo</i></a>, for ease-of-use.</p>
    214 <p>Like the utilities <a href="../utilities/mailx.html"><i>mailx</i></a> and <a href="../utilities/lp.html"><i>lp</i></a>,
    215 <i>logger</i> is admittedly difficult to test. This was not deemed sufficient justification to exclude these utilities from this
    216 volume of POSIX.1-2024. It is also arguable that they are, in fact, testable, but that the tests themselves are not portable.</p>
    217 </blockquote>
    218 <h4 class="mansect"><a name="tag_20_70_19" id="tag_20_70_19"></a>FUTURE DIRECTIONS</h4>
    219 <blockquote>
    220 <p>None.</p>
    221 </blockquote>
    222 <h4 class="mansect"><a name="tag_20_70_20" id="tag_20_70_20"></a>SEE ALSO</h4>
    223 <blockquote>
    224 <p><a href="../utilities/lp.html#"><i>lp</i></a> , <a href="../utilities/mailx.html#"><i>mailx</i></a> , <a href=
    225 "../utilities/write.html#tag_20_151"><i>write</i></a></p>
    226 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a></p>
    227 </blockquote>
    228 <h4 class="mansect"><a name="tag_20_70_21" id="tag_20_70_21"></a>CHANGE HISTORY</h4>
    229 <blockquote>
    230 <p>First released in Issue 4.</p>
    231 </blockquote>
    232 <h4 class="mansect"><a name="tag_20_70_22" id="tag_20_70_22"></a>Issue 7</h4>
    233 <blockquote>
    234 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    235 </blockquote>
    236 <h4 class="mansect"><a name="tag_20_70_23" id="tag_20_70_23"></a>Issue 8</h4>
    237 <blockquote>
    238 <p>Austin Group Defect 917 is applied, adding the <b>-f</b>, <b>-i</b>, <b>-p</b>, and <b>-t</b> options, and specifying the
    239 behavior when <i>logger</i> is executed with no operands.</p>
    240 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    241 </blockquote>
    242 <div class="box"><em>End of informative text.</em></div>
    243 <hr>
    244 <p>&nbsp;</p>
    245 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    246 <hr size="2" noshade>
    247 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    248 POSIX™ is a Trademark of The IEEE.<br>
    249 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    250 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    251 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    252 ]</font></center>
    253 <hr size="2" noshade>
    254 <div class="NAVHEADER">
    255 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    256 <tr class="nav">
    257 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/localedef.html" accesskey="P">&lt;&lt;&lt;
    258 Previous</a></td>
    259 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    260 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/logname.html" accesskey="N">Next
    261 &gt;&gt;&gt;</a></td>
    262 </tr>
    263 </table>
    264 <hr align="left" width="100%"></div>
    265 </body>
    266 </html>