serverpod-logging

Log server requests per session with configurable database and console output.

3.2k|369|Updated May 22, 2021
One-click install
npx skills add https://github.com/serverpod/serverpod --skill serverpod-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serverpod-logging
Source: https://github.com/serverpod/serverpod/tree/main/packages/serverpod/skills/serverpod-logging
Command: npx skills add https://github.com/serverpod/serverpod --skill serverpod-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you diagnose failing endpoints and understand behavior during a request without manually hunting through scattered console output or guessing what happened inside the server.

Core Features & Use Cases

  • Session-based logging with session.log(): Write logs tied to the current request session and have them flush when the session closes.
  • Configurable destinations and persistence: Store logs in database tables and/or print to console using text or JSON formats, based on your configuration.
  • Retention and cleanup controls: Prevent log tables from growing without bound by setting time-based and count-based retention.

Use case: When an endpoint throws an exception, the Skill supports logging it as session failures (e.g., for auditing why a call failed or to find the slow stage), then reviewing the results in Serverpod’s logging UI.

Quick Start

Use the serverpod-logging skill to add session.log() calls inside your endpoints, then configure sessionLogs to enable the database and/or console output you want.

Frequently Asked Questions about serverpod-logging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug failing server endpoints using session logs?

Store server logs in database tables by configuring sessionLogs to enable database persistence. This maps your session logs to serverpod_log, serverpod_query_log, and serverpod_session_log tables, allowing you to review them in the logging UI.

Can I configure server log retention to prevent database tables from growing infinitely?

Configure server log retention using built-in time-based and count-based cleanup controls. Setting these retention parameters prevents your serverpod_log, serverpod_query_log, and serverpod_session_log database tables from growing without bound over time.

What is the best way to monitor slow server calls in a Serverpod backend?

Monitor slow server calls by implementing session-based logging to diagnose operational issues across request lifecycles. Logging through session.log() captures the timing of internal stages, helping you find the slow stage within a failing or delayed endpoint request.

Does Serverpod logging support printing session logs to the console?

Serverpod logging supports printing session logs to the console using configurable text or JSON formats. You can independently enable console output alongside or instead of database persistence based on your specific debugging and monitoring requirements.

How do I track exceptions across a server request lifecycle without scattered console output?

Track exceptions across a server request lifecycle by using session-scoped logging tied to the current request. This prevents manually hunting through scattered console output by flushing correlated logs directly to the database or console when the session closes.