LOG EVENT

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11.2 (Modified)


LOG EVENT ({outputType; }message{; importance})

ParameterTypeDescription
outputTypeIntegerMessage output type
messageStringContents of the message
importanceIntegerMessage's importance level

Description

The LOG EVENT command allows you to set up a customized system for recording internal events that occur during the use of your application.

Pass the custom information to be noted according to the event in message.

The optional outputType parameter can be used to specify the output channel taken by the message. You can pass one of the following constants, located in the "Log Events" theme, in this parameter:

ConstantTypeValue
Into Windows Log EventsLongint0
Into 4D Debug MessageLongint1
Into 4D Request LogLongint2
Into 4D Commands LogLongint3

Note: If you omit the outputType parameter, the command uses channel 0 (Into Windows Log Events).

Into Windows Log Events: This value indicates to 4D to send the message to the "Log events" of Windows. This log receives and stores messages coming from running applications.

Notes:

- For this feature to be available, the Windows Log Events service must be running.

- Under Mac OS, the command does nothing with this output type.

Into 4D Debug Message: This value indicates to 4D to send the message to the system debugging environment. The result depends on the platform:

- Under Mac OS: the command sends the message to the Console

- Under Windows: the command sends the message as a debug message. To be able to read this message, you must have Microsoft Visual Studio or the DebugView utility for Windows (http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx).

Into 4D Request Log: This value indicates to 4D to record the message in the 4D requests log, if this file has been activated.

Into 4D Commands Log: This value indicates to 4D to record the message in the 4D commands log file, if this file has been activated.

Note: 4D log files are grouped together in the Logs folder, which is created next to the database structure file (see the Get 4D folder command).

If you have defined the outputType parameter as Into Windows Log Events, you can attribute a level of importance to message, via the optional importance parameter which helps you to read and understand the log events. There are three levels of importance: Information, Warning, and Error.

4D provides you with the following predefined constants, placed in the "Log Events" category:

ConstantTypeValue
Information MessageInteger0
Warning MessageInteger1
Error MessageInteger2

If you don't pass anything in importance or pass an incorrect value, the default value (0) is used.

Example

If you want to have keep track of when your database is opened under Windows, you could write the following line of code in the On Startup Database Method:

   LOG EVENT (Into Windows Log Events;"The Invoice database was opened.")

Each time the database is opened, this information will be written in Windows' log events and its level of importance will be 0.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next