Thursday, 26 July 2007

Feature/admin: Cluster synchronisation log improvements

Added date and time to the first line of the log items written to standard output by {\tt ClusterSync.pl} when \verb+$verbose+ is set and set standard output to ``autoflush'' mode so log items are written immediately regardless of redirection.

Implemented a proper log file for {\tt ClusterSync.pl}. The full path name for the log file is configured with ``Cluster Synchronisation Log File''. If the null string, logging is disabled. Otherwise, the specified file is opened for appending, and items are appended for each transaction. When logging is active, the program listens for the {\tt HUP} signal and, upon receiving it, closes and re-opens the log file to permit it to be rotated by renaming it and then sending the signal. The format of the log file identical to the information written to {\tt STDOUT} when \verb+$verbose+ is nonzero. The default location for the log file is {\tt /server/log/hackdiet/ClusterSync.log}.

Replaced all of the parallel calls in {\tt ClusterSync.pl} to write output to standard output in verbose mode and to the log file when logging with calls on a new {\tt logmsg} function which writes its arguments to the appropriate destinations according to the global option variables.

No comments: