IEEE P1003.2 Draft 11.2 - September 1991 Copyright (c) 1991 by the Institute of Electrical and Electronics Engineers, Inc. 345 East 47th Street New York, NY 10017, USA All rights reserved as an unpublished work. This is an unapproved and unpublished IEEE Standards Draft, subject to change. The publication, distribution, or copying of this draft, as well as all derivative works based on this draft, is expressly prohibited except as set forth below. Permission is hereby granted for IEEE Standards Committee participants to reproduce this document for purposes of IEEE standardization activities only, and subject to the restrictions contained herein. Permission is hereby also granted for member bodies and technical committees of ISO and IEC to reproduce this document for purposes of developing a national position, subject to the restrictions contained herein. Permission is hereby also granted to the preceding entities to make limited copies of this document in an electronic form only for the stated activities. The following restrictions apply to reproducing or transmitting the document in any form: 1) all copies or portions thereof must identify the document's IEEE project number and draft number, and must be accompanied by this entire notice in a prominent location; 2) no portion of this document may be redistributed in any modified or abridged form without the prior approval of the IEEE Standards Department. Other entities seeking permission to reproduce this document, or any portion thereof, for standardization or other activities, must contact the IEEE Standards Department for the appropriate license. Use of information contained in this unapproved draft is at your own risk. IEEE Standards Department Copyright and Permissions 445 Hoes Lane, P.O. Box 1331 Piscataway, NJ 08855-1331, USA +1 (908) 562-3800 +1 (908) 562-1571 [FAX] Part 2: SHELL AND UTILITIES P1003.2/D11.2 4.36 logger - Log messages 4.36.1 Synopsis logger _s_t_r_i_n_g ... 4.36.2 Description The logger utility saves a message, in an unspecified manner and format, containing the _s_t_r_i_n_g operands provided by the user. The messages are expected to be evaluated later by personnel performing system administration tasks. 4.36.3 Options None. 4.36.4 Operands The following operands shall be supported by the implementation: _s_t_r_i_n_g One of the string arguments whose contents are concatenated together, in the order specified, separated by single s. 4.36.5 External Influences 4.36.5.1 Standard Input None. 4.36.5.2 Input Files None. 4.36.5.3 Environment Variables The following environment variables shall affect the execution of logger: LANG This variable shall determine the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 4.36 logger - Log messages 583 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX LC_) do not specify a locale. See 2.6. LC_ALL This variable shall determine the locale to be used to override any values for locale categories specified by the settings of LANG or any environment variables beginning with LC_. LC_CTYPE This variable shall determine the locale for the interpretation of sequences of bytes of text data as characters (e.g., single- versus multibyte characters in arguments). LC_MESSAGES This variable shall determine the language in which diagnostic messages should be written. 4.36.5.4 Asynchronous Events Default. 4.36.6 External Effects 4.36.6.1 Standard Output None. 4.36.6.2 Standard Error Used only for diagnostic messages. 4.36.6.3 Output Files Unspecified. 4.36.7 Extended Description None. 4.36.8 Exit Status The logger utility shall exit with one of the following values: 0 Successful completion. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 584 4 Execution Environment Utilities Part 2: SHELL AND UTILITIES P1003.2/D11.2 >0 An error occurred. 4.36.9 Consequences of Errors Default. BEGIN_RATIONALE 4.36.10 Rationale. (_T_h_i_s _s_u_b_c_l_a_u_s_e _i_s _n_o_t _a _p_a_r_t _o_f _P_1_0_0_3._2) _E_x_a_m_p_l_e_s_,__U_s_a_g_e This utility allows logging of information for later use by a system administrator or programmer in determining why noninteractive utilities have failed. POSIX.2 makes no requirements for the locations of the saved message, their format, or retention period. It also provides no method for a portable application to read messages, once written. (It is expected that the POSIX.7 System Administration standard will have something to say about that.) The purpose of this utility might best be illustrated by an example. A batch application, running noninteractively, tries to read a configuration file and fails; it may attempt to notify the system administrator with: logger myname: unable to read file foo. [time stamp] The text with LC_MESSAGES about diagnostic messages means diagnostics from logger to the user or application, not diagnostic messages that the user is sending to the system administrator. _H_i_s_t_o_r_y__o_f__D_e_c_i_s_i_o_n_s__M_a_d_e Multiple _s_t_r_i_n_g arguments were allowed, similar to echo, for ease of use. In Draft 9, the posixlog utility was renamed logger to match its BSD forebear, with which it is (downward) compatible. The working group believed strongly that some method of alerting administrators to errors was necessary. The obvious example is a batch utility, running noninteractively, that is unable to read its configuration files, or that is unable to create or write its results file. However, the working group did not wish to define the format or delivery mechanisms as they have historically been (and will probably continue to be) very system specific, as well as involving functionality clearly outside of the scope of this standard. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 4.36 logger - Log messages 585 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX Like the utilities mailx and lp, logger is admittedly difficult to test. This was not deemed sufficient justification to exclude these utilities from the standard. It is also arguable that they are, in fact, testable, but that the tests themselves are not portable. END_RATIONALE 4.37 logname - Return user's login name 4.37.1 Synopsis logname 4.37.2 Description The logname utility shall write the user's login name to standard output. The login name shall be the string that would be returned by the POSIX.1 {8} _g_e_t_l_o_g_i_n() function. Under the conditions where the _g_e_t_l_o_g_i_n() function would fail, the logname utility shall write a diagnostic message to standard error and exit with a nonzero exit status. 4.37.3 Options None. 4.37.4 Operands None. 4.37.5 External Influences 4.37.5.1 Standard Input None. 4.37.5.2 Input Files None. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 586 4 Execution Environment Utilities