Error logs in Bitrix are essential for diagnosing issues such as server misconfigurations, PHP errors, or database-related problems. Understanding how to access and interpret these logs can help resolve issues faster.
Locating the Bitrix Error Log
Bitrix-Specific Log Files
Bitrix has a built-in logging system. The logs can be found in:
/bitrix/php_interface/after_connect.php
/bitrix/modules/logs/
Web Server Log Files
Depending on your web server configuration:
- Apache logs:
- Nginx logs:
- PHP-FPM logs:
/var/log/apache2/error.log
/var/log/nginx/error.log
/var/log/php7.x-fpm.log
Custom Error Log for Bitrix
If you have configured Bitrix to write custom logs, check the file path set in the code:
define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/bitrix/log.txt");
Log entries are saved in:
/bitrix/log.txt
Enabling Error Logging in Bitrix
Enable PHP Error Logging
- Open your php.ini file:
sudo nano /etc/php/7.x/apache2/php.ini
- Enable logging and set the log file:
log_errors = On
error_log = /var/log/php_errors.log - Restart the web server:
sudo systemctl restart apache2
Enable Bitrix Debugging
Edit the dbconn.php file in your Bitrix installation:
define("DEBUG_MODE", true); // Enable debugging
define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/bitrix/log.txt"); // Custom log file
define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/bitrix/log.txt"); // Custom log file
Checking Common Errors in Bitrix Logs
| Error Type | Typical Error | Fix |
|---|---|---|
| Database Connection Errors | [DB Connection Error]: Unable to connect to the database |
sudo systemctl status mysql
|
| PHP Errors | PHP Fatal error: Uncaught Error: Call to undefined function |
sudo apt install php-mysql php-gd
|
| Module Loading Errors | Error: Unable to load module /bitrix/modules/some_module |
|
Analyzing and Filtering Logs
Search for Specific Errors
Use grep to filter relevant log entries:
grep "ERROR" /bitrix/log.txt
Monitor Logs in Real-Time
Use tail to monitor logs as issues occur:
tail -f /bitrix/log.txt
Clearing Old Logs
Large log files can consume disk space and slow down the server.
- Check the size of log files:
- Clear log files:
du -sh /bitrix/log.txt
> /bitrix/log.txt
Best Practices for Bitrix Error Logging
- Rotate Logs Automatically:
- Use logrotate to manage large log files:
- Example configuration:
sudo nano /etc/logrotate.d/bitrix/var/www/bitrix/log.txt {
daily
rotate 7
compress
missingok
notifempty
} - Set Appropriate Log Levels:
- Only enable detailed logging for troubleshooting.
- Disable detailed logs in production to improve performance.
- Secure Log Files:
- Restrict permissions:
chmod 600 /bitrix/log.txt
- Locate and enable logs in /bitrix/log.txt or /var/log/.
- Use error logs to debug database, PHP, or server-related issues.
- Regularly clean and rotate logs to optimize performance.


