Bitrix Site Manager


 string text,
 string module_id = ""

The function AddMessage2Log adds a new record to the log file.

The constant LOG_FILENAME containing the absolute path to the log file should be defined prior to calling this function. If you fail to define the constant, the function does not perform any operation. The constant LOG_FILENAME can be defined in the beginning of a page or in one of the following files:

If an error occurs, the function AddMessage2Log is called by the following methods:

The log file accumulates all records added to it. To clean the log file, simply delete it.

You can dump all database queries for debugging purposes. To do so, initialise the variable $DBDebugToFile with true in the file /bitrix/php_interface/dbconn.php.


text Message text.
module_id The module ID whose message is added.

Optional, "" by default.

See Also


// file /bitrix/php_interface/dbconn.php

// define LOG_FILENAME, set it to the log file pathname
define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/log.txt");
// add message to log
AddMessage2Log("My message", "my_module_id");
// issue an incorrect SQL query
// the script is halted and an error message is added to log