Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Defines the current expression log filters for EDMexpressVM. Logging with the specified filters can be turned on an off by subsequent edmiStartExpressionsLog and edmiStopExpressionsLog operations. The edmiCloseExpressionsLog operation terminates a logging operation and reset the logging filters. Hence, after an edmiCloseExpressionsLog operation, a new edmiDefineExpressionsLog operation is required to define a new logging session.
The following operations will produce log information when the "expressions log" is turned on:

  • Reading derive attributes
  • Invoking any of the validation operations: edmiValidateGlobalRule , edmiValidateGlobalRuleBN , edmiValidateInstance , edmiValidateInstanceType , edmiValidateInstanceTypeBN , edmiValidateModel , edmiValidateModelBN , edmiValidateWhereRule , edmiValidateWhereRuleBN
  • Invoking any of the query functions: edmiExecuteQuery , edmiExecuteQueryBN

The logging filter controls the logging of the conversion process. This filter is defined by the <declarationsToLog>, <sourceAreaToLog> and <options> arguments. The filter defines the following:

  1. When should logging be active
  2. Which part of the source schema should be logged

It is normally important to specify an appropriate logging filter to avoid the log output to fill up the disk. 
Related functions: edmiStartExpressionsLog , edmiStopExpressionsLog , edmiCloseExpressionsLog , edmiValidateGlobalRule , edmiValidateGlobalRuleBN , edmiValidateInstance , edmiValidateInstanceType , edmiValidateInstanceTypeBN , edmiValidateModel , edmiValidateModelBN , edmiValidateWhereRule , edmiValidateWhereRuleBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiDefineExpressionsLog(SdaiString  declarationsToLog,
                                    SdaiString  sourceAreaToLog, 
                                    SdaiString  logFile, 
                                    SdaiInteger maxLogFileSize, 
                                    SdaiString  userOutputFile, 
                                    SdaiInteger options); 
Arguments:

declarationsToLog

Specifies the Express-X /Express declarations that should be executed when logging should be performed, I.e., the part of the source schema(s) defined in the <sourceAreaToLog> argument will only be logged when those parts are executed on behalf of the declarations specified in the <declarationsToLog> argument.
Legal Express-X/Express declarations are: Map, Compose, Statements, Where, Derive attribute and Rule. An Express-X /Express declaration can be specified by the name, i.e., map name, function name, etc., or by the line number in the source schema where the actual construct is declared. The names of the Express-X/Express constructs are case insensitive.
The Where and Derive attribute names must be qualified with the actual Type or Entity name.
Example: "Person.wr2"
Any number of declarations can be specified. White space and comma can be used as delimiter between each declaration in this argument. The order of the declarations in the input field is insignificant.
This argument and the <sourceLinesToLog> argument specifies that only the parts of the schema(s) defined by these arguments should be logged, otherwise the complete schema would be logged when logging is enabled.
This argument can be set to NULL meaning that the part of the schema defined in the < sourceAreaToLog> argument should always be logged.

sourceAreaToLog

Specifies the Express-X/Express source line intervals that should be logged during the conversion process. A source line interval is specified either as the name of a declaration of type: map, compose, statements, function, procedure, where rule and rule, or by a single line number or by the first line number and the last line number separated by the hyphen '-' character. Any number of intervals can be specified, the intervals are separated by a comma. The order of the intervals is not significant.
Example: "10, 20-30, 2000 - 2200, 99, Man2Woman"
The names of where rules must always be qualified with the owners (entity or type) name.
This argument and the <declarationsToLog> argument specifies that only the parts of the Express-X/Express schema defined by these arguments should be logged, otherwise the complete schema would be logged when logging is enabled.
This argument can be set to NULL meaning that all parts of the schema will be logged.

logFile

Specifies the name of the file that will hold the log information. This file can be an existing file or the name of a file that will be created by the conversion process. Default file extension is ".log".
This argument is only valid when the option LOG_TO_FILE is set.

maxLogFileSize

Specifies an integer value that is the maximum number of bytes the specified <logFile> can hold before the <logFile> is closed. Specifying the value 0 (zero) means that no size limit for the <logFile> is defined. This argument is only effective when the <logFile> argument is specified and the LOG_TO_FILE option is set.

userOutputFile

Specifies the name of a file that will be used to receive the result of executing the xpxPrintf and xpxOutputValue function in the actual schema. The specified file can be an existing file or the name of a file that will be created by the EDMmodelConverter. The default file extension is ".txt".
This argument is only effective when the USER_OUTPUT_TO_FILE option is set.
The output of the xpxPrintf and xpxOutputValue function will be written to the EDMinterface current output device when the <userOutputFile> is set to NULL. The EDMinterface current output device can be defined by the edmiDefineOutputFunction operation.

options

Specifies the current options. The <options> value should be defined as a bitwise OR between the options to enable. All the option names are defined in the header file sdai.h . Default options are enabled when the value of <options> is set to zero.

Option Description

USER_OUTPUT_TO_FILE

Specifies that the result from the Express-X functions xpxPrintf and xpxOutputValue will be written to the file specified in the <userOutputFile> argument.
When none of the options USER_OUTPUT_TO_FILE or USER_OUTPUT_TO_STDOUT are set, then the output from these function will be written to the actual <logFile> if defined, else the output from these functions will be written to the EDMinterface current output device.

USER_OUTPUT_TO_STDOUT

Specifies that the result from the Express-X functions xpxPrintf and xpxOutputValue will be written to the EDMinterface current output device.
When none of the options USER_OUTPUT_TO_FILE or USER_OUTPUT_TO_STDOUT are set, then the output from these function will be written to the actual <logFile> if defined, else the output from these functions will be written to the EDMinterface current output device.

FULL_LOG

Specifies that all available logging options except LOG_AGGREGATE_CONTENTS should be enabled.

LOG_CONDITIONS

Specifies that the evaluation of all logical conditions in the actual Express-X schema should be logged.

LOG_EXPRESSIONS

Specifies that the evaluation of all Express-X expressions should be logged.

LOG_PREDEF_FUNCTIONS

Specifies that the execution of all built-in Express-X functions and procedures should be logged.

LOG_FUNCTIONS

Specifies that the evaluation of all logical conditions in the actual Express-X schema should be logged.

LOG_INSTANCE_CREATION

Specifies that all instance creation in the conversion process should be logged.

LOG_ASSIGNMENTS

Specifies that the execution of all assignment statements should be logged.

LOG_AGGREGATE_CONTENTS

Specifies that when the actual data type to be recorded is an aggregate, the value of all aggregate elements will be written in the log record, otherwise only the aggregateID would be written to the actual log record.
Note: this option may generate very much log information.

LOG_RULE_SCHEMA_ONLY

Log declarations in the rule schema only.

LOG_TIME_USED

The time used in calculating a derive attribute or validating a rule will be logged.

LOG_RULE_RESULT

The result of rule validation will be logged.

LOG_ERRORS

Specifies that all error events detected in the process should be logged.

LOG_WARNINGS

Specifies that all warning events detected in the actual conversion process should be logged.

LOG_TO_FILE

Specifies that the log records should be written to the file specified in the <logFile> argument.
The options LOG_TO_FILE and LOG_TO_STDOUT can be combined.

LOG_TO_STDOUT

Specifies that the log records should be written to the EDMinterface current output device.
The options LOG_TO_FILE and LOG_TO_STDOUT can be combined.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
EdmiError rstat;
...
If (rstat = edmiDefineExpressionsLog (
"Man2MaleAdult, Woman2FemaleAdult, Child2BoyOrGirl", 
"Child2BoyOrGirl, 200 – 550, 1100 – 1290", 
"/usr/hkd/tmp/expressions.log", 
0, 
"/usr/hkd/tmp/user_output.text", 
FULL_LOG | LOG_TO_FILE | USER_OUTPUT_TO_FILE)) { 
 
/* Error in operation */  
printf("\nError in edmiDefineExpressionsLog: %s\n", 
edmiGetErrorText(rstat)); 
goto error; 
}
...

  • No labels