Documentation Library

Logging - Function

Enables the programmer to dynamically start and stop filtering options. The effect will be immediate and will not update the Magic.ini file.

Syntax:

Logging (Start/Stop, 'Filter'[, context entry or identifier])

Parameters:

Start/Stop – A logical value in which True will start the filter (set the value to true) or False will clear the value, depending on the property. For example, if the Oracle filter is set to Developer, False will set it to None.
If the Start/Stop parameter is false, the DBMS parameter may appear without the extra information. For example: Logging ('FALSE'LOG, 'DB2/400')

Filter – An Alpha string defining the filter option. Valid values are:

  • Task

  • Levels

  • DataView

  • Recompute

  • Flow

  • Events

  • LogClient

  • TransCache

  • LogSynch

  • BeginEndMsg

  • Gateway

  • BackgroundMsg

  • ExternalLogFileName=(file name)

  • Btrieve= (N, D, S, or C)

  • Pervasive= (N, D, S, or C)

  • DB2/400= (N, D, S, or C)

  • ORACLE= (N, D, S, or C)

  • AS/400= (N, D, S, or C)

  • DB2= (N, D, S, or C)

  • ODBC= (N, D, S, or C)

  • MicrosoftSQLServer = (N, D, S, or C)

  • Memory= (N, D, S, or C)

  • MySQL= (N, D, S, or C)

  • SQLite= (N, D, S, or C)

  • ALL

  • RESET

context entry or identifier (optional) – A number representing the context. This number can be either the context entry number in the current context list or the actual context identifier. This parameter enables you to define whether the function should affect all contexts or a specific context. Since version: 2.4b

Returns:

Logical – True for Success or False for Failure

Examples:

Logging('TRUE'LOG, 'Levels') – Turns on logging for Levels

Logging('FALSE'LOG, 'Recompute') – Turns off logging for recompute activity.

Logging('FALSE'LOG, 'ALL') – Turns off all logging

Logging('TRUE'LOG, 'RESET') – Sets logging back to the value stored in the Magic.ini file.

Logging('TRUE'LOG, 'ORACLE=D') – Sets Oracle logging to the Developer level.

Note:

If an invalid filter (or blank) is used, the function will return False.

If an external log is not set and the Debug mode is not set, the function will return False.

If an external log is set using ExternalLogFileName and the file cannot be created, the function will return False. A message should be sent to the mgerror.log file.

If the Start/Stop parameter is evaluated to False and the DBMS parameter is evaluated to either D, S, C (for example, 'False','ODBC=D'), the gateway will be set to N.

If the Start/Stop parameter is evaluated to True and the DBMS parameter is evaluated to N (for example, 'True','ODBC=N'), the gateway option will be ignored and the function will return False.

If the Studio is not in Debug mode, this will only have an effect on the external log (if set).

The function will affect all running contexts.  

The set values will only be valid for the current instance. Once returning to the Studio, the values will be reset to their INI defaults.

If ALL is used together with Stop (False), all values will be set to False.

If ALL is used together with Start (True), then all non-gateway logical values will be set to True.

RESET is used to reset all values to the INI values. If RESET is used with Start (True), all values will be reset. If RESET is used with STOP, it will be ignored and the function will return False.

When using the Logging function to set the Gateway Log file, Sync or Level values, this change will affect all contexts and not just a specific context. Since version: 2.4b

See also:

Activity Monitor

Logging Settings

How Do I Control the Information Logged by the Debugger?

The Online Samples project (program SQ10)