kitloong/laravel-app-logger
A lightweight Laravel package that records application activity and errors to the database, making it easy to inspect what happened in your app without digging through flat log files. Simple to install and configure, and works out of the box with Laravel.
kitloong/laravel-app-logger records application execution — incoming HTTP requests (method, URL, headers, payload, response, timing) and console runs — as structured entries through Laravel's logging stack. It is a diagnostic/observability aid, not an audit-trail package, so treat its output as "what did the app actually receive and return."
Minimal setup:
composer require kitloong/laravel-app-logger — v1.3.0 adds Laravel 13 support, so this is the version to pin if you are on L13. Package discovery registers the service provider automatically; no manual config/app.php entry needed.php artisan vendor:publish --tag=app-logger-config. If the tag does not resolve, publish by provider (--provider="KitLoong\\AppLogger\\AppLoggerServiceProvider") and check what lands in config/.config/logging.php) before assuming output goes to laravel.log..env → APP_LOGGER_ENABLED=true (verify the exact key name in the published config; it is env-driven) — then hit a route and tail -f the resulting file under storage/logs/.First useful use case: enable it in staging only, reproduce a bug report from a QA user, and read the captured request/response pair instead of asking them to re-describe what they clicked.
Environment gating. The default posture should be: on in local/staging, off in production. Set the enable flag in .env per environment and keep the package's channel out of your production stack unless you have a retention story.
Dedicated channel + structured output. Point the package at its own channel rather than the stack channel. Each entry is a discrete, JSON-ish record, which makes it greppable and pipeable:
jq -c 'select(.status >= 500)' storage/logs/app-logger-*.log
This is where the package earns its keep — you can slice by status, duration, or route without parsing free-text log lines.
Correlate with a request ID. Add middleware that generates a UUID, calls Log::shareContext(['request_id' => $id]) (or withContext), and returns it in a response header. The package's entries then inherit the same context, so a user-reported header value takes you straight to the entry.
Gate noise at the source. Wrap the noisy parts of the app — health checks, webhook endpoints, asset routes — in an exclusion list if the config exposes one, or conditionally skip registration of the middleware in your bootstrap/app.php / route group. Logging every /up and /horizon poll drowns the signal within an hour.
Local debugging loop. During development, leave it on and keep a terminal tailing the channel. It replaces the ad-hoc Log::info($request->all()) lines people scatter through controllers, and it captures the response shape and timing for free.
Console coverage. For scheduled jobs and Artisan commands, the captured entry gives you the invocation and exit context — genuinely handy when a cron behaves differently under schedule:run than it does by hand.
Testing. Add the disable flag to phpunit.xml (<env name="APP_LOGGER_ENABLED" value="false"/>) so the suite does not generate gigabytes of log files in CI.
Authorization, Cookie, passwords, and tokens will land on disk. Mask them in the publishable config or via a custom processor before this ever runs anywhere with real user traffic.daily and constrain LOG_DAILY_DAYS, or the file grows unbounded on a busy host. Check disk usage in staging after a week before trusting it in any long-lived environment.UploadedFile instances are memory- and disk-expensive to serialize. If the config serializes the whole request, exclude file inputs or skip logging on upload routes.streamDownload, StreamedResponse, and file responses cannot be read back for logging; expect the response body to be empty or truncated for those, and do not build assertions on it.php artisan config:cache bakes the enable flag and the channel name in. Changing .env afterwards has no effect until you re-run config:cache — this is the number-one "it's on but nothing logs" cause.logging.php → middleware registered in the stack → the channel's own level is not filtering the record out.How can I help you explore Laravel packages today?