4D v16.3

LOG EVENT

Home

 
4D v16.3
LOG EVENT

LOG EVENT 


 

LOG EVENT ( {outputType ;} message {; importance} ) 
Parameter Type   Description
outputType  Longint in Message output type
message  String in Contents of the message
importance  Longint in Message’s importance level

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:

Constant Type Value Comment
Into 4D commands log Longint 3 Indicates 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, which is created next to the database structure file (see the Get 4D folder command).
Into 4D debug message Longint 1 Indicates to 4D to send the message to the system debugging environment. The result depends on the platform:
Into 4D diagnostic log Longint 5 Indicates 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 log Longint 2 Indicates to 4D to record the message in the 4D requests log, if this file has been activated
Into Windows log events Longint 0 Indicates 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.

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:

Constant Type Value
Error message Longint 2
Information message Longint 0
Warning message Longint 1

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.



See also 

SET DATABASE PARAMETER

 
PROPERTIES 

Product: 4D
Theme: System Environment
Number: 667

This command has platform-specific behaviorThis command has platform-specific behavior

 
HISTORY 

Modified: 4D v11 SQL Release 2
Modified: 4D v13

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)