Skip to content

Logs and debugging

When something goes wrong, the logs usually say why. This page shows where each log is, how to get more detail with debug mode, and what to send with a bug report. ClientFence has no automatic error reporting: the logs stay on your server and you choose what to share.

Log Where How long it is kept
What staff, clients, guests and the cron did, with errors and warnings Activity → System Activity Activity Log Retention, 90 days by default
Sign-ins Activity → Staff Login History and Client Login History The same period
Sent emails (when Log Sent Emails to Database is on) Activity → Email History Email Log Retention, kept until deleted by default
API requests and payment gateway notices (the kinds you choose) API log tab of Activity → System Activity Keep for (days), 30 by default
Gateway callbacks of one payment IPN tab of the transaction under Invoices → Transactions With the transaction
Incoming help desk mail Support → Email import log Its own period in the Support settings

Filter System Activity by Minimum Priority (for example Error and above), address, staff member, client and dates. Set the retention periods in System → Settings → Activity, see Choose log retention. The API log is turned on per source in Security → Settings → API log, see API request log. For one payment, see Reconcile payment transactions.

The files are in the log folder of the data folder, data/log/ in the ClientFence folder unless path_data in config.php names another place.

File What it holds
php_error.log PHP errors and warnings, and the full details of unexpected errors. Start here.
application/application-YYYY-MM-DD.log General messages, most of them also shown in System Activity.
cron/cron-YYYY-MM-DD.log Each cron run: started, finished, and any task that failed.
security/, email/, billing/ Sign-ins and password resets, email sending, invoice payments. Kept in the files only, not in System Activity.
routing/, event/, license/ Missing pages and template errors, events (debug mode only), software licence checks.

Each folder gets one file per day with entries, and keeps its 90 newest files. ClientFence does not trim php_error.log: empty it now and then, or rotate it with your server’s log rotation. If you do not find a line where you expect it, look in the newest files of the other folders too.

Errors that happen before ClientFence has read config.php, such as Your Configuration is Empty, go to the PHP error log of your web server or hosting panel instead.

The .htaccess file refuses web requests for .log files. The Webserver Check on the Security Dashboard checks that data/log/php_error.log cannot be downloaded. On Nginx, the server block refuses the data folder.

When a page fails in an unexpected way, clients and visitors see An unexpected error occurred. Please contact support. and the details go to php_error.log. Client and guest API calls answer An unexpected error occurred. Please try again later. and the details are logged as an error starting with Client API internal error or Guest API internal error. Signed-in staff see the real error message. Normal messages, such as a wrong password or a missing invoice, are shown to everyone.

Debug mode adds detail to the logs. Use it for a short time, to catch one problem.

  1. Copy config.php somewhere safe.
  2. As the site user, open config.php and set 'debug' => true under debug_and_monitoring.
  3. Sign in to the admin area and repeat what failed. Reload a page: the change applies at once.
  4. Read the newest lines of php_error.log and of the folders above.
  5. Set 'debug' => false again. Open the System Health tab of System → Settings → System, select Run checks now and check that Debug and error display passes.
'debug_and_monitoring' => [
'debug' => true,
'log_stacktrace' => true,
'stacktrace_length' => 25,
],

While debug mode is on:

Who What changes
Signed-in staff An unexpected error shows a full error page with the code trace and request details instead of the short page.
Every visitor PHP warnings and notices appear in the page, which can show file paths and server details.
The logs Debug lines are kept too: each event adds a line to System Activity. With log_stacktrace, every ClientFence error message, even a normal one such as a wrong password, is written to php_error.log with up to stacktrace_length lines of trace.
Cron and console.php Every database query is written to php_error.log, so the file grows fast.

The debug bar at the bottom of the pages is a development tool: it appears only when the server sets the environment variable APP_ENV to dev. Never set it on a live portal.

  1. The version. It is on Update ClientFence and in the ClientFence version line of System Health.
  2. System Health. Select Copy as text on the System Health tab. The report never names your admin address.
  3. What you did, what you expected and what happened, with the time it happened.
  4. The log lines from that time: the error in System Activity and the matching lines of php_error.log. A few lines around the error are enough.

Before you paste anything, remove secrets and personal data: passwords, API keys, tokens, the config.php contents (never share info.salt or the database password), client names, email addresses and IP addresses. Do not post a screenshot of the debug error page as it is: it shows request and server details.

Ask on the ClientFence forum, or open a GitHub issue for a bug you can repeat.

Run these from the ClientFence folder as the site user.

Terminal window
php console.php --version
tail -n 50 data/log/php_error.log
tail -n 50 "$(ls -t data/log/application/*.log | head -n 1)"
grep -h "Failed to run cron task" data/log/cron/*.log | tail -n 20

The second line shows the newest PHP errors, the third the newest general log, and the last any cron task that failed. See Console commands for more.