splash/sonata-admin-monolog-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

splash/sonata-admin-monolog-bundle

Composer 安装命令:

composer require splash/sonata-admin-monolog-bundle

包简介

Provide a Doctrine DBAL handler for Monolog with Sonata Admin Implementation. This Bundle is inspired from LexikMonologBrowserBundle.

README 文档

README

Build Status Latest Stable Version

This Symfony bundle provides a Doctrine DBAL handler for Monolog Web UI to display log entries is integrated to Sonata Admin UI.

You can list, filter and paginate logs as you can see on the screenshot bellow:

Log entries listing Log entry show

As this bundle query your database on each raised log, it's relevant for small and medium projects, but if you have billion of logs consider using a specific log server.

This Bundle is inspired from LexikMonologBrowserBundle

Requirements:

  • Symfony 3.4+ | 4.0+ | 4.2+
  • Sonata-Project/AdminBundle

Installation

Installation with composer:

    ...
    "require": {
        ...
        "splash/sonata-admin-monolog-bundle": "@stable",
        ...
    },
    ...

Next, be sure to enable these bundles in your Kernel.php file:

public function registerBundles()
{
    return array(
        // SPLASH SONATA ADMIN MONOLOG BUNDLE
        new new Splash\SonataAdminMonologBundle\SplashSonataAdminMonologBundle(),
        // ...
    );
}

Basic Configuration

Then, you can configure Monolog to use the Doctrine DBAL handler:

# app/config/config.yml # or any env
monolog:
    handlers:
        database_handler:
            type:         service
            id:           splash.sonata.admin.monolog.handler
            channels:     ["!event"]

Advanced Configuration

If you don't want to use default Doctrine Entity Manager, you need to configure the Doctrine DBAL connection to use in the handler.

You have 2 ways to do that:

By using an existing Doctrine connection:

Note: we set the logging and profiling option to false to avoid DI circular reference.

# app/config/config.yml
doctrine:
    dbal:
        connections:
            default:
                ...
            monolog:
                driver:    pdo_sqlite
                dbname:    monolog
                path:      %kernel.root_dir%/cache/monolog2.db
                charset:   UTF8
                logging:   false
                profiling: false

splash_sonata_admin_monolog:
    doctrine:
        connection_name: monolog

By creating a custom Doctrine connection for the bundle:

# app/config/config.yml
splash_sonata_admin_monolog:
    doctrine:
        connection:
            driver:      pdo_sqlite
            driverClass: ~
            pdo:         ~
            dbname:      monolog
            host:        localhost
            port:        ~
            user:        root
            password:    ~
            charset:     UTF8
            path:        %kernel.root_dir%/db/monolog.db # The filesystem path to the database file for SQLite
            memory:      ~                               # True if the SQLite database should be in-memory (non-persistent)
            unix_socket: ~                               # The unix socket to use for MySQL

Please refer to the Doctrine DBAL connection configuration for more details.

Now your database is configured, you can generate the schema for your log entry table by running the following command:

php bin/console doctrine:schema:update --force

Translations

If you wish to use default translations provided in this bundle, make sure you have enabled the translator in your config:

# app/config/config.yml
framework:
    translator: ~

Contributing

Any Pull requests are welcome!

This module is part of SplashSync project.

splash/sonata-admin-monolog-bundle 适用场景与选型建议

splash/sonata-admin-monolog-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 625 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「Symfony2」 「monolog」 「logger」 「bundle」 「doctrine」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 splash/sonata-admin-monolog-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 splash/sonata-admin-monolog-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 splash/sonata-admin-monolog-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 625
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 17
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-06