Skip to main content

Logging

Frappe includes a built-in logging system that helps developers monitor application activity, troubleshoot issues, and debug both development and production environments. Logs are available through the Desk interface as well as server-side log files.

Overview

Frappe maintains two primary categories of logs: Desk Logs, which are stored in the database and accessible through the Desk UI, and Server Logs, which are written to log files on the server.

Desk Logs

Desk Logs are stored within your site’s database and can be searched, filtered, and viewed directly from the Desk. They help administrators monitor application activity and operational events.

Common Desk logs include:

  • Access Log
  • Activity Log
  • Error Log
  • Scheduled Job Log

These logs are useful for tracking user actions, scheduled jobs, authentication events, and application errors.

Server Logs

Server Logs contain lower-level operational information generated by Bench, Frappe services, background workers, and schedulers. They are especially useful when diagnosing production issues.

Log files are commonly stored in the following locations:

./logs

./sites/{site}/logs

The most commonly used server log files include:

  • bench.log — Bench command execution logs.
  • scheduler.log — Scheduler execution and scheduled task logs.
  • worker.log — Background worker activity.
  • frappe.web.log — Web request logs generated by Frappe.

Tip

To enable web request logging, add "enable_frappe_logger": true to your site’s site_config.json.

Error Snapshots

Whenever an HTTP 500 (or higher) server error occurs, Frappe automatically creates an Error Snapshot. These snapshots preserve detailed debugging information that can later be viewed from the Desk.

An Error Snapshot typically contains:

  • Exception type and message
  • Complete Python traceback
  • HTTP request details
  • Form data
  • Local variables
  • Stack frames
  • Environment information

Snapshot files are stored in:

sites/{site}/error-snapshots/

These snapshots are periodically synchronized with the Error Snapshot DocType and are retained for approximately one month before automatic cleanup.

Note

To disable automatic error snapshots, add "disable_error_snapshot": true to your site’s configuration.

How Logging Works

Logs are generated by several components within the Frappe ecosystem, including:

  • Bench CLI
  • Frappe application
  • Scheduler
  • Background Workers
  • Redis Queue
  • Supervisor or other process managers

Together, these logs provide visibility into application behavior, background processing, and system health.

Log Maintenance

Server log files can become quite large over time. Administrators should periodically review Bench configuration files such as Procfile or supervisor.conf to identify which processes generate logs and ensure proper log rotation is configured.

Automatic Log Cleanup

Frappe provides configurable retention policies for most logging DocTypes through the Log Settings DocType.

Administrators can define how long logs should be retained before they are automatically deleted.

Custom logging DocTypes can also participate in automatic cleanup by implementing a clear_old_logs() method.

class CustomLoggingDoctype(Document):

    @staticmethod
    def clear_old_logs(days=180):

        from frappe.query_builder import Interval
        from frappe.query_builder.functions import Now

        table = frappe.qb.DocType("Custom Logging Doctype")

        frappe.db.delete(
            table,
            filters=(table.modified < (Now() - Interval(days=days)))
        )

Once implemented, the custom logging DocType automatically appears in Log Settings, allowing administrators to configure its retention period.

Additional Monitoring

For more advanced monitoring, Frappe can be combined with:

  • Frappe Logging API
  • Bench and Scheduler logs
  • MariaDB or PostgreSQL server logs
  • NGINX access and error logs
  • Background worker monitoring

Best Practice

Review both Desk Logs and Server Logs when troubleshooting production issues. Desk Logs help identify application-level events, while Server Logs provide detailed operational information that is often essential for diagnosing complex problems.

Rating: 0 / 5 (0 votes)