Project Support

Extras: Log System

The cfhtlog service provides a permanent (on-disk) circular buffer of recent log messages. A tool called roll allows you to view the log and C API calls from libcfht allow programs to log messages. If compiled with the appropriate options, director will also save all of its log messages to the roll buffer. Without this, log messages displayed in director are only kept in shared memory.

Start the log service

The first step for setting up a machine to support cfhtlog is to add the following in rc.local:

# rc.local
  [ . . . ]

# ===============
export CFHTLOGU=
export CFHTLOGS=/tmp/cfhtlog.np
/gpc/bin/roll -s 500000000 -p $CFHTLOGS /gpc/conf/syslog.@
/gpc/bin/cfht_log reboot START "logging system started by $0"

After add those commands to rc.local, run them manually (or reboot.) Warning: The first time you run roll -s to create the buffer on disk, it can take several minutes.

Rebuild "director" with cfht_log

In the source tree, edit cli/director/Makefile and add a section the hostname:

ifeq ($(HOSTNAME), insert.your.full.hostname.here)

Note that this is setting the NO_CFHTLOG variable to (empty) which turns ON the logging feature.

cd cli/director
make clean ; make install

Reboot or re-start director.

Viewing the Log

This displays the last 5 hours of log messages:

/gpc/bin/roll -u -CF -h 5 | less

For more information, see the man page:

man /gpc/man/man1/roll.1