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 Logging Laravel Package

minvws/laravel-logging

MinVWS Laravel Logging provides a consistent logging setup for Laravel applications, with configurable channels and contextual logging to support diagnostics and auditing. It integrates with Laravel’s native logging system for maintainable, production-ready logs.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install and discover the package. Require minvws/laravel-logging via Composer. Laravel package discovery should register the service provider; verify this in bootstrap/providers.php or config/app.php if auto-discovery is disabled.
  2. Publish configuration and migrations. Use php artisan vendor:publish for the package provider and inspect what lands in config/. If database logging is supported, run php artisan migrate and confirm the audit table/schema.
  3. Choose a destination early. Decide whether day-to-day logs go to the database, syslog, a stack/local channel, or a combination. Configure this through the published config and environment variables rather than hard-coding channels.
  4. Run a smoke test. Resolve the package logger/facade from the container, log a harmless test event with an action, actor, subject, and context, then verify the record in the configured destination.
  5. Look first at: the package README, published config, the Laravel service provider, migrations, and the underlying minvws/audit-logger package. The Laravel package is likely a thin integration layer, so the audit logger is the source of truth for event structure and contracts.

A good first real use case is auditing authentication and sensitive-data access: login/logout, failed login, admin impersonation, record viewing/export, and permission changes. That gives immediate compliance value without requiring broad application refactoring.

Implementation Patterns

  • Wrap the package in an application-level audit service. Create a small AuditService or AuditLogger wrapper with methods such as logAuth, logDataAccess, and logAdminAction. This centralizes event names, required context, and redaction rules instead of scattering package calls across controllers.
  • Log at domain boundaries. Prefer logging from controllers, form listeners, jobs, and console commands rather than deep inside models. For CRUD-heavy domains, use model observers to capture create/update/delete events, but whitelist fields and redact sensitive values.
  • Enrich context centrally. Add middleware that captures request ID, authenticated user ID, tenant/organization, IP address, user agent, route, and correlation ID. Pass that context into the audit logger so every event has consistent attribution.
  • Use domain events and listeners. Dispatch events such as UserLoggedIn, RecordExported, or PermissionGranted, then let listeners call the package logger. This keeps controllers clean and makes it easy to add or remove audit behavior.
  • Design for multiple destinations. Use the database for queryable audit trails and retention, syslog for SIEM/compliance pipelines, and a local/stack channel for development. If the package supports per-channel routing, separate security-critical events from operational noise.
  • Queue non-critical logs, keep critical logs synchronous. Async logging is useful for high-volume access logs, but security-critical events should be written synchronously or via a transactional outbox so they are not lost when a queue worker fails.
  • Test with a fake or test destination. Bind a spy/fake logger in feature tests and assert that the expected action and context were logged. Reset the fake between tests to avoid cross-test leakage.
  • Plan retention and querying. Add indexes for timestamp, actor, action, and subject. Schedule pruning/archiving, and export important events to the SIEM if syslog is the compliance target.

Gotchas and Tips

  • Maturity risk is real. This is a low-adoption, internal iRealisatie package with zero dependents. Pin the version, read changelogs, and avoid assuming broad community support or stable public APIs.
  • Database logging can fail inside transactions. Audit writes may deadlock, hit constraints, or roll back with the business transaction. Decide explicitly whether audit failure should fail the request or fail open with an alert.
  • Do not log secrets or unnecessary PII. Redact request bodies, tokens, passwords, health data, and free-text fields. Prefer an allowlist of context fields over a denylist.
  • Syslog is lossy unless configured carefully. UDP syslog can drop or truncate messages. Prefer TCP/TLS where compliance matters and test maximum message size.
  • Clear config cache after changes. Run php artisan config:clear or config:cache in deployment after changing environment variables or published config.
  • Treat migrations as production schema changes. Review the published audit table, indexes, and column sizes before deploying. Avoid editing published migrations after they have run in production.
  • Queue context may be incomplete. Jobs and queued listeners often lack the original request context. Serialize the actor and correlation ID explicitly rather than relying on request globals.
  • Check the underlying audit-logger API. If a method or event shape is missing, it may belong to minvws/audit-logger rather than the Laravel wrapper. Read that package’s source before forking the integration.
  • Use extension points before forking. Prefer custom destinations, formatters, serializers, or event classes via configuration where available. Forking a small internal package creates long-term maintenance cost.
  • Standardize timestamps and formats. Log UTC/ISO-8601 timestamps and stable action names so database queries and SIEM parsing remain reliable across services.
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