salehhub/laravel-remote-logger
Composer 安装命令:
composer require salehhub/laravel-remote-logger
包简介
Send Laravel logs to a centralized remote logging server
README 文档
README
Send your Laravel application logs to a centralized remote logging server.
Features
- Zero config — just install, set env vars, and go
- Bearer token authentication
- Asynchronous logging (queued) to avoid slowing down requests
- Automatic retry on failure (3 attempts with backoff)
- Configurable timeout and SSL verification
- Fallback to local logging on failure
Installation
composer require salehhub/laravel-remote-logger
The package auto-registers via Laravel's package discovery.
Configuration
1. Add Environment Variables
REMOTE_LOGGER_URL=https://your-logging-server.com/api/logs REMOTE_LOGGER_API_KEY=your-api-key REMOTE_LOGGER_APP_NAME=MyApp
All available environment variables:
| Variable | Default | Description |
|---|---|---|
REMOTE_LOGGER_URL |
http://localhost:8000/api/logs |
Remote server endpoint |
REMOTE_LOGGER_API_KEY |
null |
Bearer token for authentication |
REMOTE_LOGGER_APP_NAME |
APP_NAME |
Application identifier |
REMOTE_LOGGER_LEVEL |
debug |
Minimum log level to send |
REMOTE_LOGGER_ASYNC |
true |
Send logs via queue |
REMOTE_LOGGER_QUEUE |
null |
Queue name (null = default queue) |
REMOTE_LOGGER_VERIFY_SSL |
true |
Verify SSL certificates |
REMOTE_LOGGER_TIMEOUT |
5 |
HTTP request timeout in seconds |
2. Set as Default Log Channel
LOG_CHANNEL=remote
The remote channel is auto-registered by the package. No need to edit config/logging.php.
3. Queue Setup (for async logging)
php artisan queue:work
Usage
use Illuminate\Support\Facades\Log; Log::info('User logged in', ['user_id' => 123, 'category' => 'Auth', 'subcategory' => 'Login']); Log::error('Payment failed', ['order_id' => 456, 'category' => 'Payments', 'subcategory' => 'Stripe']); Log::warning('High memory usage detected', ['category' => 'System']);
Global Context (Optional)
You can set a global category or subcategory that applies to all logs in the current request or job. This is useful for assigning a broad category to an entire request cycle.
use RemoteLogger\Facades\RemoteLogger; // At the beginning of a request or job RemoteLogger::setContext('Billing', 'StripeProvider'); // Or separately RemoteLogger::setCategory('Billing'); RemoteLogger::setSubcategory('StripeProvider');
Global settings (via RemoteLogger facade) will always take precedence over values provided in the log context.
Remote Server Payload
Your server should accept POST requests with this JSON structure:
{
"application": "MyApp",
"environment": "production",
"level": "info",
"message": "User logged in",
"category": "Auth",
"subcategory": "Login",
"context": {"user_id": 123},
"logged_at": "2024-02-08 10:30:00"
}
The request includes an Authorization: Bearer <api_key> header when REMOTE_LOGGER_API_KEY is set.
Publishing Config
php artisan vendor:publish --tag=remote-logger-config
Synchronous Mode
Set REMOTE_LOGGER_ASYNC=false to send logs synchronously (not recommended for production).
License
MIT
salehhub/laravel-remote-logger 适用场景与选型建议
salehhub/laravel-remote-logger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 596 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「remote」 「laravel」 「centralized」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 salehhub/laravel-remote-logger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 salehhub/laravel-remote-logger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 salehhub/laravel-remote-logger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Allow packages to be installed from a repository or tarball bundle that have multiple packages in the sub-folders
PHP library that allows linking queries from diferent physical databases using mysql pdo database connections
A Zend Framework module that sets up Monolog for logging in applications.
Asynchronous Sentry for Symfony - Fire and forget
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
High-performance, zero-dependency PSR-3 logger for MonkeysLegion with structured logging, handlers, processors, and PHP 8.4 features.
统计信息
- 总下载量: 596
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-09