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 Database

Laravel Log Database Laravel Package

sinemacula/laravel-log-database

A Laravel package that stores application log entries in a database table instead of flat files, making logs easier to query, filter, and retain. It plugs into Laravel's logging channels so existing Log calls work unchanged while records are persisted and browsable.

View on GitHub
Deep Wiki
Context7

A database Monolog log driver for Laravel that persists application log records to an Eloquent-backed table.

Frequently asked questions about Laravel Log Database
What is sinemacula/laravel-log-database used for?
It is a database-backed Monolog log driver for Laravel that persists application log records to an Eloquent-backed table instead of only writing flat files. It plugs into Laravel's existing logging channel configuration, so existing Log calls can keep working while records become easier to query, filter, and retain. The package is best thought of as a supplemental or environment-specific channel rather than a universal replacement for stdout or file logging.
How do I install sinemacula/laravel-log-database in a Laravel app?
The expected integration is a Composer require followed by publishing the package config and migration, then adding a database channel to config/logging.php. The assessment recommends doing this on a feature branch and verifying the published migration, schema, and payload shape in staging before promoting the channel into your default stack. Check the README for the exact publish tags and channel key names for your pinned version.
Do I need to change my existing Log::info() calls to use the database channel?
No application-code changes are normally required because the package integrates at Laravel's logging channel level. Once the channel is configured and included in your log stack, existing Log facade calls flow through the configured handlers. You can also keep the database channel alongside file or stderr channels by adding it to a stack rather than making it the default.
Which Laravel and PHP versions does sinemacula/laravel-log-database support?
The v1.1.0 composer.json constraints are the source of truth. The assessment specifically warns that a minor release claiming Laravel 13 support may either widen constraints to something like ^12.0|^13.0 or silently raise the minimum version, and a Laravel 13 constraint can also imply a newer PHP floor. Read the constraints literally, confirm Laravel 12 is still allowed if that is your baseline, and check whether the CI matrix actually exercises each declared version.
Can I write logs asynchronously or buffer them to reduce database load?
The assessment flags async and buffered write paths as an open question rather than a confirmed feature. A synchronous Monolog handler typically performs one insert per log record, which can dominate request cost under verbose logging. If no queue or buffer option exists, bound the volume with a strict channel-level minimum level and consider wrapping writes in your own queued job.
What happens if the log insert fails, and can it cause infinite logging recursion?
A naive database handler can recurse when a database error triggers another log write that also fails. The assessment says you must confirm the handler swallows exceptions and degrades safely rather than letting logging failures break the request. Test this deliberately in staging by simulating a failed connection or missing table, and keep a file or stderr fallback channel available.
Does the package include a migration, and can I customize the table name?
The integration notes expect a publishable migration, so plan to review the schema before running it. Whether the table name is configurable is listed as a key question to resolve, which matters if you already have a logs table or share a database across services. Check the published config file and confirm any schema collision risk before enabling the channel.
How do I prune old log records and stop the log table from growing forever?
The package overview does not imply any automatic retention or pruning, so you must own that policy. Add a scheduled job that deletes rows older than your retention window, and monitor table size and index growth as part of normal operations. Do this before enabling the channel in production, not after the table has already grown large.
Are database log records rolled back when my application transaction fails?
If log writes use the same database connection inside an open transaction, they share that transaction's fate and will be rolled back with it. That can silently destroy the audit trail for exactly the failures you most want to investigate. Consider writing critical audit records outside the transaction, using a separate connection, or keeping a file/stderr channel for failure-path logging.
Should I use sinemacula/laravel-log-database as my primary log channel in production?
The assessment considers it a poor fit as a primary sink for high-throughput or multi-tenant services because synchronous database writes add failure coupling and write amplification. It is most valuable as a supplemental channel where queryable logs are an operational requirement, such as single-tenant or on-prem deployments, or as a stopgap before centralized observability. For containerized production, keep stdout or file logging as the default and run the database channel at warning or error with a retention policy.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console