PHPackages                             kitloong/laravel-app-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. kitloong/laravel-app-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

kitloong/laravel-app-logger
===========================

Laravel log for your application

v1.3.0(5mo ago)101.4M↓43%16MITPHPPHP &gt;=7.1.3CI passing

Since Jan 10Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/kitloong/laravel-app-logger)[ Packagist](https://packagist.org/packages/kitloong/laravel-app-logger)[ Docs](https://github.com/kitloong/laravel-app-logger)[ Fund](https://www.buymeacoffee.com/kitloong)[ RSS](/packages/kitloong-laravel-app-logger/feed)WikiDiscussions 1.x Synced 2w ago

READMEChangelog (10)Dependencies (12)Versions (15)Used By (6)

Laravel Application Logger
==========================

[](#laravel-application-logger)

[![Run tests](https://github.com/kitloong/laravel-app-logger/workflows/Run%20tests/badge.svg?branch=1.x)](https://github.com/kitloong/laravel-app-logger/workflows/Run%20tests/badge.svg?branch=1.x)[![Latest Stable Version](https://camo.githubusercontent.com/3e0188f5f5b584be463301ca91e54afbe38ad742be790a1327fcde0d41d548cd/68747470733a2f2f706f7365722e707567782e6f72672f6b69746c6f6f6e672f6c61726176656c2d6170702d6c6f676765722f762f737461626c652e706e67)](https://packagist.org/packages/kitloong/laravel-app-logger)[![License](https://camo.githubusercontent.com/1a04a977f38f41565d120dff6cdf29187e12ad1e3f4dcac88875dae341bb8ff6/68747470733a2f2f706f7365722e707567782e6f72672f6b69746c6f6f6e672f6c61726176656c2d6170702d6c6f676765722f6c6963656e73652e706e67)](https://packagist.org/packages/kitloong/laravel-app-logger)

This package provides middleware that generates **HTTP request** and **performance** logs from incoming requests.

This package also provides a Database **query log** to log all executed queries in your application.

Installation
------------

[](#installation)

```
composer require kitloong/laravel-app-logger
```

Usage
-----

[](#usage)

To start using **HTTP request** and **performance** logger please add the package's middleware in your `app/Http/Kernel.php` or routes.

```
\KitLoong\AppLogger\Middlewares\AppLogger::class

```

No code modification needed to use the Database **query log**, you only need to enable it through `.env`.

By default, **HTTP request** and **performance** are enabled while the **query log** is disabled.

However, you could change each setting respectively to a different environment.

```
# By default

RUN_HTTP_LOG=true
RUN_PERFORMANCE_LOG=true
RUN_QUERY_LOG=false
```

Log format
----------

[](#log-format)

### Http request log

[](#http-request-log)

```
[2021-01-10 23:35:27] local.INFO: 2725ffb10adeae3f POST /path - Body: {"test":true} - Headers: {"cookie":["Phpstorm-12345"],"accept-language":["en-GB"]} - Files: uploaded.txt

```

### Performance log

[](#performance-log)

```
[2021-01-10 23:35:27] local.INFO: 2725ffb10adeae3f POST /path 201 - Time: 55.82 ms - Memory: 22.12 MiB

```

### Query log

[](#query-log)

```
[2021-01-10 23:35:27] local.INFO: Took: 2.45 ms mysql Sql: select * from `users` where `id` = 1

```

What's more
-----------

[](#whats-more)

This package uses  as the base for the **HTTP request** log, as well as the code design pattern.

It is common to receive tons of incoming requests in a real-life production application.

To ease for analysis, a unique string is embedded into **HTTP request** and **performance** log to indicate both log entries are related.

```
# HTTP request, unique: 2725ffb10adeae3f
[2021-01-10 23:35:25] local.INFO: 2725ffb10adeae3f GET /path - Body ...

# Performance, unique: 2725ffb10adeae3f
[2021-01-10 23:35:27] local.INFO: 2725ffb10adeae3f GET /path 200 - Time: 55.82 ms - Memory: 5.12 MiB

```

If you found any high memory usage or slow requests you could easily grep request log by the unique string for more information.

Configuration
-------------

[](#configuration)

You could also publish the config file to change more configuration or even use your own implementation:

```
php artisan vendor:publish --provider="KitLoong\AppLogger\AppLoggerServiceProvider" --tag=config
```

You could check the content of the config file [here](config/app-logger.php).

### Config: Logging channel

[](#config-logging-channel)

By default, Laravel App Logger writes logs into your default logging channel.

However, you may implement a new logging channel in Laravel `config/logging.php`, and overwrite the `channel` in the published config file.

An example is written for a better explanation.

In Laravel `config/logging.php`:

```
'channels' => [
    'request' => [
        'driver' => 'daily',
        'path' => storage_path('logs/request.log'),
        'level' => 'debug',
        'days' => 14,
    ],

    'performance' => [
        'driver' => 'daily',
        'path' => storage_path('logs/performance.log'),
        'level' => 'debug',
        'days' => 14,
    ],

    'query' => [
        'driver' => 'daily',
        'path' => storage_path('logs/query.log'),
        'level' => 'debug',
        'days' => 14,
    ],
]
```

In `config/app-logger.php`:

```
'http' => [
    ...
    'channel' => 'request'
],
'performance' => [
    ...
    'channel' => 'performance'
],
'query' => [
    ...
    'channel' => 'query'
]
```

### Config: Implement own logger

[](#config-implement-own-logger)

You could even write your own logger implementation and overwrite it in the config file.

Here is the code snippet of **HTTP request**:

```
/*
 * The log profile which determines whether a request should be logged.
 * It should implement `HttpLogProfile`.
 */
'log_profile' => \KitLoong\AppLogger\HttpLog\LogProfile::class,

/*
 * The log writer used to write the request to a log.
 * It should implement `HttpLogWriter`.
 */
'log_writer' => \KitLoong\AppLogger\HttpLog\LogWriter::class,
```

You could find a similar configuration in the `performance` and `query` section.

When you write your own `log_profile`, you must implement each loggers' own `LogProfile` interface.

LoggerInterfacehttp`\KitLoong\AppLogger\HttpLog\HttpLogProfile`performance`\KitLoong\AppLogger\PerformanceLog\PerformanceLogProfile`query`\KitLoong\AppLogger\QueryLog\QueryLogProfile`The interface requires `shouldLog` implementation. This is where you place your log condition.

When you write your own `log_writer`, you must implement each loggers' own `LogWriter` interface.

LoggerInterfacehttp`\KitLoong\AppLogger\HttpLog\HttpLogWriter`performance`\KitLoong\AppLogger\PerformanceLog\PerformanceLogWriter`query`\KitLoong\AppLogger\QueryLog\QueryLogWriter`The interface requires `log` implementation. This is where you define your log body message.

License
=======

[](#license)

The Laravel Application Logger is open-sourced software licensed under the [MIT license](LICENSE)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance73

Regular maintenance activity

Popularity45

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~172 days

Recently: every ~187 days

Total

12

Last Release

150d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7adbe78d5387ce1f89901e4432ae6bf1f633966bcfdce0be971c6ed85b613c9?d=identicon)[kitloong](/maintainers/kitloong)

---

Top Contributors

[![kitloong](https://avatars.githubusercontent.com/u/7660346?v=4)](https://github.com/kitloong "kitloong (49 commits)")[![kevincobain2000](https://avatars.githubusercontent.com/u/629055?v=4)](https://github.com/kevincobain2000 "kevincobain2000 (1 commits)")

---

Tags

access-loglaravellogsperformance-logquery-logrequestloglaravelperformancequery

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kitloong-laravel-app-logger/health.svg)

```
[![Health](https://phpackages.com/badges/kitloong-laravel-app-logger/health.svg)](https://phpackages.com/packages/kitloong-laravel-app-logger)
```

###  Alternatives

[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.4k131.9M235](/packages/sentry-sentry-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M189](/packages/spatie-laravel-health)[larabug/larabug

Laravel 6.x/7.x/8.x/9.x/10.x/11.x/12.x/13.x bug notifier

298594.9k1](/packages/larabug-larabug)[spatie/laravel-flare

Send Laravel errors to Flare

131.6M8](/packages/spatie-laravel-flare)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
