Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

Logger - Sending Messages to a System Log File

News See also Recommended Links Recommended Articles Messages Classification Configuration examples AIX syslog

The logger command enables you to send messages to the syslogd daemon. The syntax  is:

logger [ -i ] [ -f file ] [ -p priority ] [ -t tag ] [ message ]

where:

You can specify the message priority as a facility.level pair. For example, -p local3.info assigns the message priority of the info level in the local3 facility.

The default priority is user.notice.

Therefore, the following example logs the message System rebooted to the syslogd daemon, using the default priority level notice and the facility user:

# logger System rebooted

If the user.notice selector field is configured in the /etc/syslog.conf file, the message is logged to the file designated for the user.notice selector field.

If the user.notice selector field is not configured in the /etc/syslog.conf file, you can either add the user.notice selector field to the /etc/syslog.conf file, or you can prioritize the output as follows:

# logger -p user.err System rebooted

Changing the priority of the message to user.err routes the message to the /var/adm/messages file as indicated in the /etc/syslog.conf file. A message priority can also be specified numerically.

For example, logger -i -p2 "crit" creates an entry in the message log that identifies the user.crit-facility.level pair as follows:

Nov 3 09:49:34 hostname root[2838]: [ID 702911 user.crit] crit

Old News ;-)

Recommended Links


In case of broken links please try to use Google search. If you find the page please notify us about new location
Google     

 

 

 


Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: August 08, 2009