Skip to main content
Version: 20 R7 BETA

LOG EVENT

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

ParameterTypeDescription
outputTypeIntegerMessage output type
messageTextContents of the message
importanceIntegerMessage’s importance level

Description

The LOG EVENT command sets 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 specifies the output channel taken by the message. You can pass one of the following constants, located in the "Log Events" theme, in this parameter:

ConstantTypeValueComment
Into 4D commands logInteger3Indicates to 4D to record the message in the 4D commands log file, if this file has been activated. The 4D commands log file can be enabled using the SET DATABASE PARAMETER command (selector 34).
Note: 4D log files are grouped together in the Logs folder (see the Get 4D folder command).
Into 4D debug messageInteger1Indicates 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 ConsoleUnder 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 diagnostic logInteger5Indicates to 4D to record the message in the 4D diagnostic file, if this file has been enabled.
The diagnostic log file can be enabled using the SET DATABASE PARAMETER command (selector 79).
Into 4D request logInteger2Indicates to 4D to record the message in the 4D requests log, if this file has been activated
Into system standard outputsInteger6Indicates to 4D to send the message to a standard output stream. The message is sent to: stdout if importance = Information message or Warning message stderr if importance = Error message
Into Windows log eventsInteger0Indicates to 4D to send the message to the “Log events” of Windows. This log receives and stores messages coming from running applications. In this case, you can attribute a level of importance to message via the optional importance parameter (see below).
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

If you do not pass the outputType parameter, the value 0 (Into Windows log events) is used by default.

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:

ConstantTypeValue
Error messageInteger2
Information messageInteger0
Warning messageInteger1

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

note

The importance parameter is only used with outputType Into Windows log events, Into 4D diagnostic log, and Into system standard outputs.

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.

See also

SET DATABASE PARAMETER

Properties

Command number667
Thread safe