zero1/module-custom-logging
Composer 安装命令:
composer require zero1/module-custom-logging
包简介
Allows you to configure different logging 'stacks' on a per environment basis. This would allow you to have a logging level of DEBUG on non_production and ERROR on production.
关键字:
README 文档
README
Allows configurable logging, on a per environment basis. Whilst still keeping the logging configuration in source control.
100% compatible with Mdoq
To setup you will need to add the following snippets to the appropriate files.
On you production sites make sure you change the stack value to production.
In addition to this if you are running multiple webheads you can the hardware_instance value to identify each web head. eg admin-01, web-asg-01 this will then be added to the logs.
env.php Config Example
'logging' => [ 'hardware_instance' => 'server1-blahblah', 'stack' => 'non_production' ],
config.php Config Example
'logging' => [ 'stacks' => [ 'production' => [ 'handlers' => [ 'productionDefaultLogger' => [], ], 'common_formatter' => \Monolog\Formatter\JsonFormatter::class, 'common_processors' => [ \Monolog\Processor\GitProcessor::class, \Monolog\Processor\IntrospectionProcessor::class, \Monolog\Processor\WebProcessor::class, \Zero1\CustomLogging\Logger\Processor\HardwareInstance::class, ] ], 'non_production' => [ 'handlers' => [ 'nonProductionDefaultLogger' => [], 'nonProductionDebugLogger' => [], ], 'common_formatter' => 'loggingLineFormatter', 'common_processors' => [ \Monolog\Processor\GitProcessor::class, \Monolog\Processor\IntrospectionProcessor::class, \Monolog\Processor\WebProcessor::class, \Zero1\CustomLogging\Logger\Processor\HardwareInstance::class, ] ] ] ]
Additional Information
The changes you make in app/etc/env.php are meant to be environment specific. In here you can configure the logging 'stack' you want to use. This value will be out of source control. The 'stack' is purely a nice name to a set of logging configuration defined in app/etc/config.php. In app/etc/config.php you can configure as many different stacks as you want e.g 'production', 'staging', 'local'. Each of these stacks is stored in source control allowing the stacks to be used by anyone on your code base.
In addition to be able to change the 'stack' with a single environment value, we can also add additional things to all loggers, so that all messages get this info. The default example adds four 'processors' that add extra info.
'common_processors' => [ \Monolog\Processor\GitProcessor::class, \Monolog\Processor\IntrospectionProcessor::class, \Monolog\Processor\WebProcessor::class, \Zero1\CustomLogging\Logger\Processor\HardwareInstance::class, ]
These will be added to all handlers:
'handlers' => [ 'nonProductionDefaultLogger' => [], 'nonProductionDebugLogger' => [], ]
These link to the loggers that are defined in etc/di.xml
How this is different from Magento core:
- In magento core, you would have to make changes in source controlled files to change the logging verbosity. (Not ideal as production should have the same source files as staging, yet they should have different logging verbosity / settings)
- In magento core there is no way to configure different stacks of loggers.
zero1/module-custom-logging 适用场景与选型建议
zero1/module-custom-logging 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 06 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「logs」 「magento」 「magento 2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zero1/module-custom-logging 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zero1/module-custom-logging 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zero1/module-custom-logging 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The tenancy/tenancy logs mutations
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).
Laravel 5.x.x library for integration Monolog Sentry
High-performance, zero-dependency PSR-3 logger for MonkeysLegion with structured logging, handlers, processors, and PHP 8.4 features.
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2019-06-21