Difference between revisions of "Message System"

From MidasWiki
Jump to navigation Jump to search
Line 1: Line 1:
<div id="midas.log"></div>
<div id="midas.log"></div>
== MIDAS Log file ==
== MIDAS Log file ==

Revision as of 16:49, 14 July 2015

MIDAS Log file

MIDAS provides a general MIDAS log file for recording system and user messages across the different components of the data acquisition clients. The default name of this file is midas.log. It is not necessary for mlogger to be running for the MIDAS message logging system to work. As soon as any MIDAS application is started, the MIDAS log file is produced. The MIDAS log file contains system and user messages generated by any application connected to the given experiment.

Note that MIDAS messages may alternatively be sent into the data stream for logging.

Viewing MIDAS messages

All the MIDAS messages can be found in midas.log. More convenient is the mhttpd Message Page where the latest MIDAS messages are displayed. The very latest midas message can also be found on the mhttpd Status Page. Midas messages are also sent to any clients running in an xterm (e.g. odbedit).

Location of the MIDAS log file midas.log

The location of this file is dependent on how the experiment has been setup, i.e.

with the /Logger ODB tree

If the /Logger ODB tree exists (i.e. has been created by mlogger)

  • The message file will be located in the defined directory specified by the key /Logger/Data dir.
  • The name of the message file may be changed using the ODB key /Logger/Message File.
without the /Logger ODB tree

If the /Logger ODB tree does NOT exist , i.e. the MIDAS standard logger mlogger is not being used,

  • the location of the log file will be in the experiment-specific directory defined by either
    • the Environment Variable named MIDAS_DIR , or if this not defined,
    • the exptab file .

Generating messages for the MIDAS log

Any client can produce status or error messages to be sent to the MIDAS log file with a single call to cm_msg() using the MIDAS library, e.g.

status = db_find_key(hDB, 0, "/Equipment/Cycle_scalers/Settings/",&hKey);
 if(status != DB_SUCCESS && status != DB_NO_KEY)
     cm_msg(MERROR, "begin_of_run", "error accessing \"/Equipment/Cycle_scalers/Settings/\"  (%d)",status);
     return status;

Depending on the message type, these messages are forwarded to any other clients who may be available to receive these messages, as well as to the central MIDAS Log file midas.log. The message system is based on the buffer manager scheme, but with a dedicated header to identify the type of message. A dedicated buffer (i.e. shared memory) .SYSMSG.SHM is used to receive and distribute messages.

Message Types

The predefined MIDAS Message macros contained in the MIDAS library provide a list of defined messages types. These Macros compact the 3 first arguments of the cm_msg() call. The Macro replaces the type of message, the routine name and the line number in the C-code. See example in cm_msg().

The available message types ( defined in midas.h ) for use with cm_msg() are:

   MERROR : For error (MT_ERROR, __FILE__, __LINE__)
   MINFO : For info (MT_INFO, __FILE__, __LINE__)
   MDEBUG : For debug (MT_DEBUG, __FILE__, __LINE__)
   MUSER : Produced by interactive user (MT_USER, __FILE__, __LINE__)
   MLOG : Info message which is only logged (MT_LOG, __FILE__, __LINE__)
   MTALK : Info message for speech system (MT_TALK, __FILE__, __LINE__)
   MCALL : Info message for telephone call (MT_CALL, __FILE__, __LINE__)

Example MIDAS Log file

Fri Mar 24 10:48:40 2000 [CHAOS] Run 8362 started
Fri Mar 24 10:48:40 2000 [Logger] Run #8362 started
Fri Mar 24 10:55:04 2000 [Lazy_Tape] cni-043[10] (cp:383.6s) /dev/nst0/run08360.ybs 849.896MB file NEW
Fri Mar 24 11:24:03 2000 [MStatus] Program MStatus on host umelba started
Fri Mar 24 11:24:03 2000 [MStatus] Program MStatus on host umelba stopped
Fri Mar 24 11:27:02 2000 [Logger] stopping run after having received 1200000 events
Fri Mar 24 11:27:03 2000 [CHAOS] Run 8362 stopped
Fri Mar 24 11:27:03 2000 [SUSI] saving info in run log
Fri Mar 24 11:27:03 2000 [Logger] Run #8362 stopped
Fri Mar 24 11:27:13 2000 [Logger] starting new run
Fri Mar 24 11:27:14 2000 [CHAOS] Run 8363 started
Fri Mar 24 11:27:14 2000 [CHAOS] odb_access_file -I- /Equipment/kos_trigger/Dump not found
Fri Mar 24 11:27:14 2000 [Logger] Run #8363 started
Fri Mar 24 11:33:47 2000 [Lazy_Tape] cni-043[11] (cp:391.8s) /dev/nst0/run08361.ybs 850.209MB file NEW
Fri Mar 24 11:42:35 2000 [CHAOS] Run 8363 stopped
Fri Mar 24 11:42:40 2000 [SUSI] saving info in run log
Fri Mar 24 11:42:41 2000 [ODBEdit] Run #8363 stopped
Fri Mar 24 12:19:57 2000 [MChart] client [umelba.Triumf.CA]MChart failed watchdog test after 10 sec
Fri Mar 24 12:19:57 2000 [MChart] Program MChart on host koslx0 stopped