About serverpod-logging
A Serverpod skill for recording request-scoped logs and configuring their storage and output. It helps Serverpod developers inspect logs through the serverpod MCP server or Serverpod Insights.
Key features
- 01Request-scoped logging with session.log()
- 02Database and console destinations
- 03Configurable retention and cleanup
- 04Serverpod Insights log inspection
Use cases
- 01Record warnings and exceptions during requests
- 02Review failed or slow calls in Serverpod Insights
MCP support
Logs can be read through the serverpod MCP server.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ serverpod/ serverpod --skill serverpod-loggingAfter installing, type/serverpod-loggingin Claude Code to confirm it loaded.
Details
From the project READMEServerpod Logging
Use session.log() during a request. Logs flush when the session closes. Stored in DB and/or printed to console.
Usage
session.log('Operation completed');
session.log('Something went wrong',
level: LogLevel.warning,
exception: e,
stackTrace: stackTrace);
Uncaught endpoint exceptions are logged as session failures in serverpod_session_log.
Destinations
- Logs are readable through the
serverpodMCP server. - Database: Tables
serverpod_log,serverpod_query_log,serverpod_session_log(when persistent enabled) - Console: When console logging enabled (format:
textorjson)
Defaults: persistent logging is on when a database is configured, and it is only applied on PostgreSQL (SQLite has no persistent session logs). Console logging is on without a database and in the development run mode; the console format is text in development and json in the other run modes.
Configuration
Under sessionLogs: in the config YAML:
| Setting | Default |
|---|---|
| persistentEnabled | true (with DB) |
| consoleEnabled | true (no DB, or development) |
| consoleLogFormat | text (development), json (other modes) |
| cleanupInterval | 24h |
| retentionPeriod | 90d |
| retentionCount | 100000 |
Each setting also has a SERVERPOD_SESSION_* environment variable, listed in serverpod-configuration/references/environment-variables.md.
Set retention so log tables don't grow unbounded. Avoid logging sensitive data.
Serverpod Insights
Companion app for viewing, searching, and filtering logs and inspecting failed/slow calls. Automatically available when using Serverpod Cloud.