Avaya Logo

Previous Topic

Next Topic

Book Contents

Book Index

logEvent/logMsg command

The logEvent/logMsg command allows shell scripts to log a specific message.

Synopsis

logEvent script msg dst pri srcFile srcLine [arg1 ...]
logMsg script msg srcFile srcLine [arg1 ...]

Description

The logEvent/logMsg command allows shell procedures to log messages using specific messages. This is as opposed to the logit command, which generates messages within the logging system, but which always uses SYSMSG as the message format for the messages it generates. The logEvent command emulates the logEvent( ) library routine, while the logMsg command emulates the logMsg( ) library routine.

The logEvent command requires a destination and a priority when it is called, and messages logged via this interface are explicitly logged to the specified destinations and at the specific priority.

The logMsg command does not take a destination mask or a priority. It gets these pieces of information from the logging destination and a priority shared memory maintained by the logDstPri command via the /usr/spool/log/msgDst.rules file.

Both logEvent and logMsg require that the proper number of arguments be supplied for the specified message, and that numeric arguments in the message format match pure numbers from the argument list. For example:

GEN012 OUT_OF_RANGE %D<<value,D>> is out of range \ for %s<<arg,S>> in %s<<routine,S>>.

This format requires that the first argument be a number, therefore,

logMsg XXX LG_OUT_OF_RANGE – yes var compute

would fail because yes is not a number, while

logMsg XXX LG_OUT_OF RANGE – 10 var compute

would not fail.

The command line arguments are described in the following table:

Argument

Description

Comments

script

Name of the shell script for which the message is being logged.

Normally, this is either basename$0 or in ksh ${##*/}.

msg

The symbolic name of the message, for example: LG_OUT_OF_RANGE

dst

The bit mask specification of where the message is sent

This is only used with the logEvent command. It may be a number or symbolic destinations, as specified in msgDst.rules. If more than one symbolic destination is specified, they should be concatenated with a plus sign ( + ), for example, stderr+log

pri

The priority of the message

This is only used with the logEvent command. It may be any of the following:

  • 0 ( - or NONE)
  • 1 (M or MANUAL)
  • 2 ( * or MINOR)
  • 3 ( ** or MAJOR)
  • 4 ( *C or CRITICAL)

srcFile Q

The name of the file from which the logEvent or logMsg command is being issued

If you do not care, you may use a hyphen ( - ). Supplying the correct value is of value for debugging purposes, particularly if a script might generate at the same message from more than one place. If there are many individual functions within your script, you might find it advantageous to use the name of the function instead of the file.

srcLine

The line within the file from which the logEvent or logMsg command is being issued

If you do not care, you may use a hyphen ( - ). You might use $LINENO from the ksh environment, which is the line with the script or within a function.

arg1

For each argument required by a specific message format, one argument is required

The size and type of the argument must be appropriate:

  • %s (takes any kind of argument)
  • %d %u %o %x %X (argument must be a pure integer type number, for example: 10, 5, 0177, 0x8e )
  • %f %e %g %E %G (argument is interpreted as a pure floating point number, for example: 15, 15.3, 1.56E3 )
  • %c (argument must be a single character, for example: x, 5, % )

See also

© 2006 Avaya Inc. All Rights Reserved.