Message System: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
MIDAS provides a general 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 log file is produced.
{{Pagelinks}}
The [[#Example MIDAS Log file|MIDAS log file]] contains system and user messages generated by any application connected to the given experiment.
<div id="midas.log"></div>
== 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 [[#Example MIDAS Log file|MIDAS log file]] contains system and user messages generated by any application connected to the given experiment.  


== Location of the log file midas.log ==
Note that MIDAS messages may alternatively be sent into the data stream for logging.
The location of this file is dependent on the setup of the experiment.
 
== 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]] :
; with the [[/Logger ODB tree]] :
If the <span style="color: purple;">''/Logger''</span> ODB tree exists (i.e. has been created by [[mlogger]])  
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 [[DataDir|/Logger/Data dir]].
* 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 [[MessageFile|/Logger/Message File]].
* 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]] :
;without the [[/Logger ODB tree]] :
Line 19: Line 30:
----
----
== Generating messages for the MIDAS log ==
== 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.
Any client can produce status or error messages to be sent to the [[#MIDAS Log file]] with a single call to  
[http://ladd00.triumf.ca/~daqweb/doc/midas-devel/doc/html/group__msgfunctionc.html#gaac032ca2438c47466bfc9722de6746ea cm_msg()] using the MIDAS library, e.g.


  status = db_find_key(hDB, 0, "/Equipment/Cycle_scalers/Settings/",&hKey);
  status = db_find_key(hDB, 0, "/Equipment/Cycle_scalers/Settings/",&hKey);
Line 30: Line 42:
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
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.  
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  
The message system is based on the [[Midas Core#The Buffer Manager|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.
memory) .SYSMSG.SHM is used to receive and distribute messages.


Line 36: Line 48:


<div id="Message Macros"></div>
<div id="Message Macros"></div>
== Message Types ==
== Message Types ==


The predefined MIDAS Message macros contained in the MIDAS library provide a list of defined messages 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.  
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 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:
The available message types ( defined in midas.h ) for use with cm_msg() are:
Line 51: Line 65:
     MTALK : Info message for speech system (MT_TALK, __FILE__, __LINE__)
     MTALK : Info message for speech system (MT_TALK, __FILE__, __LINE__)
     MCALL : Info message for telephone call (MT_CALL, __FILE__, __LINE__)
     MCALL : Info message for telephone call (MT_CALL, __FILE__, __LINE__)


== Example MIDAS Log file ==
== Example MIDAS Log file ==
Line 75: Line 87:
  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] 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
  Fri Mar 24 12:19:57 2000 [MChart] Program MChart on host koslx0 stopped
[[Category:Messages]] [[Category:Macros]]

Latest revision as of 15:03, 4 August 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