{"id":20917781,"url":"https://github.com/kitloong/laravel-app-logger","last_synced_at":"2026-04-01T23:49:10.201Z","repository":{"id":37945562,"uuid":"303748585","full_name":"kitloong/laravel-app-logger","owner":"kitloong","description":"Laravel logs for your application","archived":false,"fork":false,"pushed_at":"2026-03-22T14:47:59.000Z","size":48,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"1.x","last_synced_at":"2026-03-23T05:53:29.436Z","etag":null,"topics":["access-log","laravel","logs","performance-log","query-log"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitloong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":["https://www.buymeacoffee.com/kitloong"]}},"created_at":"2020-10-13T15:32:41.000Z","updated_at":"2026-03-22T14:47:14.000Z","dependencies_parsed_at":"2024-11-18T16:51:46.225Z","dependency_job_id":"0600d817-32ce-4c65-a6fa-78b9d0dfe4e2","html_url":"https://github.com/kitloong/laravel-app-logger","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":"0.36111111111111116","last_synced_commit":"824a7836b4a343780290bfbba138e917b0546f52"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/kitloong/laravel-app-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-app-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-app-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-app-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-app-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitloong","download_url":"https://codeload.github.com/kitloong/laravel-app-logger/tar.gz/refs/heads/1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-app-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access-log","laravel","logs","performance-log","query-log"],"created_at":"2024-11-18T16:35:49.345Z","updated_at":"2026-04-01T23:49:10.173Z","avatar_url":"https://github.com/kitloong.png","language":"PHP","funding_links":["https://www.buymeacoffee.com/kitloong"],"categories":[],"sub_categories":[],"readme":"# Laravel Application Logger\n\n![Run tests](https://github.com/kitloong/laravel-app-logger/workflows/Run%20tests/badge.svg?branch=1.x)\n[![Latest Stable Version](https://poser.pugx.org/kitloong/laravel-app-logger/v/stable.png)](https://packagist.org/packages/kitloong/laravel-app-logger)\n[![License](https://poser.pugx.org/kitloong/laravel-app-logger/license.png)](https://packagist.org/packages/kitloong/laravel-app-logger)\n\nThis package provides middleware that generates **HTTP request** and **performance** logs from incoming requests.\n\nThis package also provides a Database **query log** to log all executed queries in your application.\n\n## Installation\n\n```bash\ncomposer require kitloong/laravel-app-logger\n```\n\n## Usage\n\nTo start using **HTTP request** and **performance** logger please add the package's middleware in your `app/Http/Kernel.php` or routes.\n\n```\n\\KitLoong\\AppLogger\\Middlewares\\AppLogger::class\n```\n\nNo code modification needed to use the Database **query log**, you only need to enable it through `.env`.\n\nBy default, **HTTP request** and **performance** are enabled while the **query log** is disabled.\n\nHowever, you could change each setting respectively to a different environment.\n\n```dotenv\n# By default\n\nRUN_HTTP_LOG=true\nRUN_PERFORMANCE_LOG=true\nRUN_QUERY_LOG=false\n```\n\n## Log format\n\n### Http request log\n\n```log\n[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\n```\n\n### Performance log\n\n```log\n[2021-01-10 23:35:27] local.INFO: 2725ffb10adeae3f POST /path 201 - Time: 55.82 ms - Memory: 22.12 MiB\n```\n\n### Query log\n\n```log\n[2021-01-10 23:35:27] local.INFO: Took: 2.45 ms mysql Sql: select * from `users` where `id` = 1\n```\n\n## What's more\n\nThis package uses https://github.com/spatie/laravel-http-logger as the base for the **HTTP request** log, as well as the code design pattern.\n\nIt is common to receive tons of incoming requests in a real-life production application.\n\nTo ease for analysis, a unique string is embedded into **HTTP request** and **performance** log to indicate both log entries are related.\n\n```log\n# HTTP request, unique: 2725ffb10adeae3f\n[2021-01-10 23:35:25] local.INFO: 2725ffb10adeae3f GET /path - Body ...\n\n# Performance, unique: 2725ffb10adeae3f\n[2021-01-10 23:35:27] local.INFO: 2725ffb10adeae3f GET /path 200 - Time: 55.82 ms - Memory: 5.12 MiB\n```\n\nIf you found any high memory usage or slow requests you could easily grep request log by the unique string for more information.\n\n## Configuration\n\nYou could also publish the config file to change more configuration or even use your own implementation:\n\n```bash\nphp artisan vendor:publish --provider=\"KitLoong\\AppLogger\\AppLoggerServiceProvider\" --tag=config\n```\n\nYou could check the content of the config file [here](config/app-logger.php).\n\n### Config: Logging channel\n\nBy default, Laravel App Logger writes logs into your default logging channel.\n\nHowever, you may implement a new logging channel in Laravel `config/logging.php`, and overwrite the `channel` in the published config file.\n\nAn example is written for a better explanation.\n\nIn Laravel `config/logging.php`:\n\n```bash\n\n'channels' =\u003e [\n    'request' =\u003e [\n        'driver' =\u003e 'daily',\n        'path' =\u003e storage_path('logs/request.log'),\n        'level' =\u003e 'debug',\n        'days' =\u003e 14,\n    ],\n    \n    'performance' =\u003e [\n        'driver' =\u003e 'daily',\n        'path' =\u003e storage_path('logs/performance.log'),\n        'level' =\u003e 'debug',\n        'days' =\u003e 14,\n    ],\n    \n    'query' =\u003e [\n        'driver' =\u003e 'daily',\n        'path' =\u003e storage_path('logs/query.log'),\n        'level' =\u003e 'debug',\n        'days' =\u003e 14,\n    ],\n]\n```\n\nIn `config/app-logger.php`:\n\n```bash\n'http' =\u003e [\n    ...\n    'channel' =\u003e 'request'\n],\n'performance' =\u003e [\n    ...\n    'channel' =\u003e 'performance'\n],\n'query' =\u003e [\n    ...\n    'channel' =\u003e 'query'\n]\n```\n\n### Config: Implement own logger\n\nYou could even write your own logger implementation and overwrite it in the config file.\n\nHere is the code snippet of **HTTP request**:\n\n```bash\n/*\n * The log profile which determines whether a request should be logged.\n * It should implement `HttpLogProfile`.\n */\n'log_profile' =\u003e \\KitLoong\\AppLogger\\HttpLog\\LogProfile::class,\n\n/*\n * The log writer used to write the request to a log.\n * It should implement `HttpLogWriter`.\n */\n'log_writer' =\u003e \\KitLoong\\AppLogger\\HttpLog\\LogWriter::class,\n```\n\nYou could find a similar configuration in the `performance` and `query` section. \n\nWhen you write your own `log_profile`, you must implement each loggers' own `LogProfile` interface.\n\n|Logger|Interface|\n|---|---|\n|http|`\\KitLoong\\AppLogger\\HttpLog\\HttpLogProfile`|\n|performance|`\\KitLoong\\AppLogger\\PerformanceLog\\PerformanceLogProfile`|\n|query|`\\KitLoong\\AppLogger\\QueryLog\\QueryLogProfile`|\n\nThe interface requires `shouldLog` implementation. This is where you place your log condition.\n\nWhen you write your own `log_writer`, you must implement each loggers' own `LogWriter` interface.\n\n|Logger|Interface|\n|---|---|\n|http|`\\KitLoong\\AppLogger\\HttpLog\\HttpLogWriter`|\n|performance|`\\KitLoong\\AppLogger\\PerformanceLog\\PerformanceLogWriter`|\n|query|`\\KitLoong\\AppLogger\\QueryLog\\QueryLogWriter`|\n\nThe interface requires `log` implementation. This is where you define your log body message.\n\n# License\n\nThe Laravel Application Logger is open-sourced software licensed under the [MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitloong%2Flaravel-app-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitloong%2Flaravel-app-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitloong%2Flaravel-app-logger/lists"}