Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Log Db

Laravel Log Db Laravel Package

yoeriboven/laravel-log-db

Store Laravel application logs in the database instead of files. This package adds a database log channel that saves messages, levels, context and timestamps to a queryable logs table, so you can browse, filter and search your logs directly from your app or admin panel.

View on GitHub
Deep Wiki
Context7

A database driver for logging with Laravel

Frequently asked questions about Laravel Log Db
How do I install yoeriboven/laravel-log-db in a Laravel app?
Install the package with composer require yoeriboven/laravel-log-db, then publish and run its migration so the logs table exists. Next, define a db channel in config/logging.php and point LOG_CHANNEL or LOG_STACK at it. For a single environment, realistic setup effort is well under a day.
Which Laravel and PHP versions does laravel-log-db 3.0 support?
Version 3.0 supports Laravel 12 and 13; it added Laravel 13 support and dropped Laravel 9, 10 and 11. PHP version support comes from the Composer constraint, so check composer.json or run a dry-run update before committing. On Laravel 11 or below, ^3.0 will not resolve, so pin 2.1.* until you upgrade.
How do I configure the database log channel in config/logging.php?
Add a channel entry in config/logging.php that uses the package's database driver, then set LOG_CHANNEL or include it in LOG_STACK. Most teams should use a stack such as [db, stderr] rather than replacing file or stderr logging wholesale. Scope the channel to the levels you actually want stored.
Can I log only errors to the database and keep info logs in files?
Yes. Because it plugs into Laravel's Monolog channel abstraction, you can route only warnings and errors to the database while framework noise stays on file or stderr. Use a stack channel or level configuration to control what reaches the db channel. This also limits write amplification.
Does laravel-log-db store log context and stack traces losslessly?
The package saves messages, levels, context and timestamps to the logs table, but the overview does not state whether large context payloads or stack traces are truncated. Test a real exception and inspect the column types before relying on it for incident forensics. If lossless exception payloads matter, confirm size limits in the migration first.
What happens if the database is unavailable while laravel-log-db is logging?
This is a key risk: when the database is unavailable, a DB log driver cannot write, and logging that failure back to the same channel can create recursion or a silent black hole. Confirm the package degrades gracefully, for example by falling back to stderr or a file. Also configure queue workers and the exception handler to avoid recursive logging.
Does laravel-log-db batch inserts or write one row per log entry?
The package overview does not document whether it batches writes or inserts one row per log entry. That distinction matters because per-entry synchronous inserts add a database round-trip for every message. Review the source or benchmark it before placing it on the critical path of a chatty service.
Are there retention or pruning commands for the logs table?
Retention and pruning commands are not mentioned in the package overview, so do not assume they are included. Check the README and source for scheduled pruning, or build your own retention job. A logs table grows quickly without a cleanup strategy.
Is laravel-log-db safe for high-traffic Laravel apps with verbose logging?
It is a poor fit for high-throughput services with very chatty logging because each entry becomes a database round-trip competing with application traffic. If you use it, scope the channel to warnings and errors only and consider a dedicated database connection. Single-server apps that already use daily files plus a log shipper may not need it.
Should I use laravel-log-db or build a custom Monolog handler?
A custom Monolog handler is roughly 50 lines and gives you full control over batching, failure behaviour and schema. This package saves that work and provides a maintained integration, but it is a small community package with single-maintainer risk. Weigh the convenience against bus factor and your required write semantics.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource