Message System: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
(The midas documentation has moved to https://midas.triumf.ca/docs/)
Tag: Replaced
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Pagelinks}}
The midas documentation has moved. The new documentation about the message system is in:
<div id="midas.log"></div>
* [https://midas.triumf.ca/docs/develop/features/monitoring_and_control/messages/ Messages: overview] (facilities, log levels and the midas.log file)
== MIDAS Log file ==
* [https://midas.triumf.ca/docs/develop/features/monitoring_and_control/messages/configuring/ Messages: configuring] (file names and forwarding messages)
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.
* [https://midas.triumf.ca/docs/develop/features/monitoring_and_control/messages/programming/ Messages: programming] (sending and reading messages from code)
The [[#Example MIDAS Log file|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]]).
 
 
<div id="midasloglocation"></div>
== 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 <span style="color: purple;">''/Logger''</span> ODB tree exists (i.e. has been created by [[mlogger]])
* The message file will be located in the defined directory specified by the key [[Keys in the ODB /Logger tree#Data dir|/Logger/Data dir]].
* The name of the message file may be changed using the ODB key [[Keys in the ODB /Logger tree#Message File|/Logger/Message File]].
 
;without the [[/Logger ODB tree]] :
If the <span style="color: purple;">''/Logger''</span>  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 types|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.
 
 
 
<div id="Message Macros"></div>
 
== 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
[http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/group__msgfunctionc.html#gaac032ca2438c47466bfc9722de6746ea 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
 
 
[[Category:Messages]]

Latest revision as of 22:01, 30 October 2026

The midas documentation has moved. The new documentation about the message system is in: