Message System: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
(Created page with "Any client can produce status or error messages with a single call to cm_msg() using the MIDAS library, e.g. status = db_find_key(hDB, 0, "/Equipment/Cycle_scalers/Settings/...")
 
No edit summary
Line 1: Line 1:
Any client can produce status or error messages with a single call to cm_msg() using the MIDAS library, e.g.
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.
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 ==
The location of this file is dependent on the setup of the experiment.
 
; 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 [[DataDir|/Logger/Data dir]].
* The name of the message file may be changed using the ODB key [[MessageFile|/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);
  status = db_find_key(hDB, 0, "/Equipment/Cycle_scalers/Settings/",&hKey);
Line 8: Line 28:
     }
     }


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 a 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.  
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 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.


<div id="Message Macros"></div>
<div id="Message Macros"></div>
== Message Types ===
== Message Types ==
Predefined Message Macros contained in the MIDAS library cover most of the message requirements. These Macros compact the 3 first arguments of the cm_msg() call.  
 
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 Macro replaces the type of message, the routine name and the line number in the C-code. See example in cm_msg().


Line 29: Line 54:




=== MIDAS Log file ===
== Example MIDAS Log file ==
 
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.
The location of this file is dependent on the setup of the experiment.
 
    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 [[DataDir|/Logger/Data dir]].
        The name of the message file may be changed using the ODB key [[MessageFile|/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, then 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 .
 
The MIDAS log file contains system and user messages generated by any application connected to the given experiment.
 
 
The predefined MIDAS Message macros provide a list of defined messages types.


  Fri Mar 24 10:48:40 2000 [CHAOS] Run 8362 started
  Fri Mar 24 10:48:40 2000 [CHAOS] Run 8362 started

Revision as of 15:06, 6 August 2013

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. The MIDAS log file contains system and user messages generated by any application connected to the given experiment.

Location of the log file midas.log

The location of this file is dependent on the setup of the experiment.

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