Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
openaec-foundation avatar

Frappe Core Logging

  • 59 installs
  • 159 repo stars
  • Updated July 8, 2026
  • openaec-foundation/erpnext_anthropic_claude_development_skill_package

Covers Frappe logging and error tracking with frappe.logger, frappe.log_error, request logging, and Sentry integration for production monitoring.

About

A reference skill for logging, error tracking, and monitoring in Frappe using frappe.logger, log_error, and Sentry. A developer uses it to add proper production logging and avoid common mistakes with print and sensitive data.

  • Three mechanisms: frappe.logger, frappe.log_error, and request logging
  • Sentry integration and production logging patterns; avoids print() and swapped args

Frappe Core Logging by the numbers

  • 59 all-time installs (skills.sh)
  • Ranked #3,167 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/openaec-foundation/erpnext_anthropic_claude_development_skill_package --skill frappe-core-logging

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs59
repo stars159
Last updatedJuly 8, 2026
Repositoryopenaec-foundation/erpnext_anthropic_claude_development_skill_package

What it does

Covers Frappe logging and error tracking with frappe.logger, frappe.log_error, request logging, and Sentry integration for production monitoring.

Files

SKILL.mdMarkdownGitHub ↗

Frappe Logging & Error Tracking

Three Logging Mechanisms

MechanismStorageUse For
frappe.logger()File (rotating)Application logging, debug info, audit trails
frappe.log_error()Database (Error Log DocType)Errors visible in admin UI, persistent tracking
frappe.log() / frappe.errprint()stderr / request-scopedQuick debugging only (NOT for production)

---

Decision Tree

Need to log something?
│
├─ Application logging (info, debug, warnings)?
│  └─ frappe.logger("my_module").info("message")
│     → Writes to sites/{site}/logs/my_module.log
│
├─ Error that admins should see in Desk UI?
│  └─ frappe.log_error(title="Short desc", message=traceback)
│     → Creates Error Log document (queryable, auto-cleanup)
│
├─ Quick debug during development?
│  └─ frappe.errprint(variable) — shows in console
│     → NEVER leave in production code
│
├─ Track all HTTP requests?
│  └─ Set enable_frappe_logger: true in site_config.json
│     → Logs to frappe.web.log
│
├─ Performance monitoring?
│  └─ Set monitor: true in site_config.json
│     → Logs to monitor.json.log (JSON, per-request metrics)
│
└─ External error tracking (Sentry)?
   └─ Set FRAPPE_SENTRY_DSN environment variable
      → Auto-captures unhandled exceptions

---

Quick Reference: frappe.logger()

# Get a logger for your module (ALWAYS specify module name)
logger = frappe.logger("my_app")

# Standard Python logging levels
logger.debug("Detailed diagnostic info")
logger.info("Normal operations: processed 50 records")
logger.warning("Something unexpected but recoverable")
logger.error("Operation failed", exc_info=True)
logger.critical("System-level failure")

# Full signature
frappe.logger(
    module=None,          # Logger name + log filename
    with_more_info=False, # Auto-log request form_dict
    allow_site=True,      # Log under site's logs/ directory
    filter=None,          # Custom logging.Filter
    max_size=100_000,     # Max bytes per log file (100KB default)
    file_count=20         # Rotated files retained (20 default)
)

Log location: sites/{site}/logs/{module}.log Rotation: RotatingFileHandler — 100KB per file, 20 backups (~2MB total per logger)

Default Log Levels

ModeLevelEffect
Development (_dev_server)WARNINGDebug/info suppressed
ProductionERROROnly errors and above
# Change level dynamically
frappe.utils.logger.set_log_level("DEBUG")

---

Quick Reference: frappe.log_error()

# ALWAYS use keyword arguments (title/message can swap otherwise)
frappe.log_error(
    title="Payment gateway timeout",          # Short description (140 chars max)
    message=frappe.get_traceback(),            # Full error details
    reference_doctype="Payment Entry",        # Related DocType
    reference_name="PE-00001"                 # Related document
)

# Minimal — auto-captures current traceback
try:
    risky_operation()
except Exception:
    frappe.log_error(title="Operation failed")

Error Log cleanup: Auto-deletes after 30 days. Manual: frappe.whitelist: clear_error_logs()

Auto-Captured Exceptions

Unhandled exceptions (HTTP 500+) are automatically logged to Error Log.

Excluded from auto-capture:

  • frappe.AuthenticationError
  • frappe.CSRFTokenError
  • frappe.SecurityException
  • frappe.InReadOnlyMode

---

Production Configuration

site_config.json Keys

KeyValueEffect
enable_frappe_loggertrueHTTP request logging → frappe.web.log
logging2Log all SQL queries (debug only!)
monitortrueRequest/job metrics → monitor.json.log
disable_error_snapshottrueDisable auto-capture of exceptions

Environment Variables

VariableEffect
FRAPPE_STREAM_LOGGING=1Log to stderr instead of files
FRAPPE_SENTRY_DSN=<dsn>Enable Sentry error tracking
ENABLE_SENTRY_DB_MONITORINGTrack SQL queries in Sentry
SENTRY_TRACING_SAMPLE_RATEPerformance tracing rate (0.0-1.0)

Production Log Files

FileContent
logs/web.error.logHTTP errors (supervisor)
logs/web.logGunicorn stdout
logs/worker.error.logBackground job errors
logs/frappe.logDefault frappe logger
logs/frappe.web.logHTTP request metadata
logs/monitor.json.logPerformance metrics (JSON)
sites/{site}/logs/*.logPer-site application logs

---

Anti-Patterns

NEVERALWAYSWhy
print("debug info")frappe.logger("mod").info(...)print() disappears in production
frappe.log_error("info msg")frappe.logger().info(...)log_error creates Error Log docs, clutters admin UI
frappe.logger() (no module)frappe.logger("my_module")No-module mixes with framework logs
frappe.log_error(title, msg) positionalfrappe.log_error(title=t, message=m)Positional args can swap (known quirk)
Log passwords/tokensMask sensitive dataSiteContextFilter only masks form_dict
frappe.log() in productionfrappe.logger()frappe.log() is debug-only, request-scoped
Leave logging=2 in prodOnly during debuggingLogs ALL SQL queries, massive I/O

---

Version Differences

Featurev14v15+
frappe.logger()YesYes
frappe.log_error()Yes+ defer_insert kwarg
Error Log trace_id--Added
Error Log metadata--JSON request/job context
Error snapshotsFile-based + scheduled collectionDirect DB insert
Sentry integrationBasicEnhanced (DB monitoring, profiling)
guess_exception_source()--Identifies which app caused error
FRAPPE_STREAM_LOGGINGYesYes

---

Reference Files

  • Logger API & Patterns — frappe.logger() advanced usage
  • Error Tracking — Error Log, Sentry, monitoring

Related skills

Backend & APIsmonitoring

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.