Sign in Join
FPDoc Onlineexperiment

TApplication.OnLog property

Member of TApplicationpublicIn unit Forms

Event handler signalled for log messages written by the application.

Declaration

pascal
property OnLog: TLogMessageEvent read FOnLog write FOnLog;

Description

OnLog is a TLogMessageEvent property with the event handler signalled when a log message is written using the application. OnLog is signalled (when assigned) from the Log method, and allows an application to perform actions needed to format and store a log message using the log storage mechanism implemented for the application.

An application must implement and assign a handler routine using the signature in TLogMessageEvent to respond to event notifications. The handler routine is responsible for all actions needed to write the message to the log storage mechanism. Arguments passed to the handler routine identify the TApplication instance for the log message (Sender), the log event type (EventType), and the message text (Msg). See TLogMessageEvent for more information.

TApplication makes no assumptions about the log storage mechanism used in the application; it is the programmer responsibility to initialize the mechanism on application start-up, and to finalize the mechanism on application shut-down. Some common logging mechanisms include: TEventLog (in FCL), TLazLogger (in LazUtils), and third party offerings like MultiLog, Log4Delphi, ExceptionLogger, or TMSLogger.

Use the Log method to write a log message handled by the event handler.

Use the EventLogFilter property to specify which log event types are forwarded to and handled by the event handler.

Added in LCL version 5.0.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.