• monolog handler用哪个


    Handlers

    记录日志到文件与系统日志(syslog)

    • StreamHandler:记录日志到任何 PHP stream,用它来记录到文件。 
    • RotatingFileHandler: 每天一个文件,会自动删除比$maxFiles老的文件,这只是一个很随意的方案, You should use logrotate for high profile setups though。
    • SyslogHandler: 记录到系统日志
    • ErrorLogHandler: Logs records to PHP's error_log()
      function.



    作者:Kaiyulee
    链接:https://www.jianshu.com/p/e6b26eb44e70
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
     

    记录到指定server与网络日志

    接着看看

    SocketHandler: Logs records to sockets, use this for UNIX and TCP sockets. See an example.
    AmqpHandler: Logs records to an amqp compatible server. Requires the php-amqp extension (1.0+).
    GelfHandler: Logs records to a Graylog2 server.
    CubeHandler: Logs records to a Cube server.
    RavenHandler: Logs records to a Sentry server using raven.
    ZendMonitorHandler: Logs records to the Zend Monitor present in Zend Server.
    NewRelicHandler: Logs records to a NewRelic application.
    LogglyHandler: Logs records to a Loggly account.
    RollbarHandler: Logs records to a Rollbar account.
    SyslogUdpHandler: Logs records to a remote Syslogd server.
    LogEntriesHandler: Logs records to a LogEntries account.

    开发环境中,利用浏览器扩展

    装扩展

    FirePHPHandler: Handler for FirePHP, providing inline console
    messages within FireBug.
    ChromePHPHandler: Handler for ChromePHP, providing inline console
    messages within Chrome.
    BrowserConsoleHandler: Handler to send logs to browser's Javascript console
    with no browser extension required. Most browsers supporting console
    API are supported.
    PHPConsoleHandler: Handler for PHP Console, providing inline console
    and notification popup messages within Chrome.

    记录到数据库

    顾名思义

    RedisHandler: Logs records to a redis server.
    MongoDBHandler: Handler to write records in MongoDB via a Mongo extension connection.
    CouchDBHandler: Logs records to a CouchDB server.
    DoctrineCouchDBHandler: Logs records to a CouchDB server via the Doctrine CouchDB ODM.
    ElasticSearchHandler: Logs records to an Elastic Search server.
    DynamoDbHandler: Logs records to a DynamoDB table with the AWS SDK.

    特殊的Handler

    慢慢看

    FingersCrossedHandler: A very interesting wrapper. It takes a logger as parameter and will accumulate log records of all levels until a record exceeds the defined severity level. At which point it delivers all records, including those of lower severity, to the handler it wraps. This means that until an error actually happens you will not see anything in your logs, but when it happens you will have the full information, including debug and info records. This provides you with all the information you need, but only when you need it.

    DeduplicationHandler: Useful if you are sending notifications or emails when critical errors occur. It takes a logger as parameter and will accumulate log records of all levels until the end of the request (or flush()
    is called). At that point it delivers all records to the handler it wraps, but only if the records are unique over a given time period (60seconds by default). If the records are duplicates they are simply discarded. The main use of this is in case of critical failure like if your database is unreachable for example all your requests will fail and that can result in a lot of notifications being sent. Adding this handler reduces the amount of notifications to a manageable level.

    WhatFailureGroupHandler: This handler extends the GroupHandler ignoring exceptions raised by each child handler. This allows you to ignore issues where a remote tcp connection may have died but you do not want your entire application to crash and may wish to continue to log to other handlers.

    BufferHandler: This handler will buffer all the log records it receives until close()
    is called at which point it will callhandleBatch()
    on the handler it wraps with all the log messages at once. This is very useful to send an email with all records at once for example instead of having one mail for every log record.

    GroupHandler: This handler groups other handlers. Every record received is sent to all the handlers it is configured with.

    FilterHandler: This handler only lets records of the given levels through to the wrapped handler.

    SamplingHandler: Wraps around another handler and lets you sample records if you only want to store some of them.

    NullHandler: Any record it can handle will be thrown away. This can be used to put on top of an existing handler stack to disable it temporarily.

    PsrHandler: Can be used to forward log records to an existing PSR-3 logger

    TestHandler: Used for testing, it records everything that is sent to it and has accessors to read out the information.

    HandlerWrapper: A simple handler wrapper you can inherit from to create your own wrappers easily.

    Formatters

    ✪ 为常用

    LineFormatter: Formats a log record into a one-line string. ✪
    HtmlFormatter: Used to format log records into a human readable html table, mainly suitable for emails.✪
    NormalizerFormatter: Normalizes objects/resources down to strings so a record can easily be serialized/encoded.
    ScalarFormatter: Used to format log records into an associative array of scalar values.
    JsonFormatter: Encodes a log record into json.✪
    WildfireFormatter: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler.
    ChromePHPFormatter: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler.
    GelfMessageFormatter: Used to format log records into Gelf message instances, only useful for the GelfHandler.
    LogstashFormatter: Used to format log records into logstash event json, useful for any handler listed under inputs here.
    ElasticaFormatter: Used to format log records into an ElasticaDocument object, only useful for the ElasticSearchHandler.
    LogglyFormatter: Used to format log records into Loggly messages, only useful for the LogglyHandler.
    FlowdockFormatter: Used to format log records into Flowdock messages, only useful for the FlowdockHandler.
    MongoDBFormatter: Converts DateTime instances to MongoDate and objects recursively to arrays, only useful with the MongoDBHandler.

    Processors

    PsrLogMessageProcessor: Processes a log record's message according to PSR-3 rules, replacing {foo}
    with the value from $context['foo'].

    IntrospectionProcessor: Adds the line/file/class/method from which the log call originated.

    WebProcessor: Adds the current request URI, request method and client IP to a log record.

    MemoryUsageProcessor: Adds the current memory usage to a log record.

    MemoryPeakUsageProcessor: Adds the peak memory usage to a log record.

    ProcessIdProcessor: Adds the process id to a log record.

    UidProcessor: Adds a unique identifier to a log record.

    GitProcessor: Adds the current git branch and commit to a log record.

    TagProcessor: Adds an array of predefined tags to a log record.



    作者:Kaiyulee
    链接:https://www.jianshu.com/p/e6b26eb44e70
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    TortoiseSVN汉化包装了,不管用,仍然是英文菜单
    sql server 2000通过机器名可以连,通过ip连不上的问题
    C# 使用js正则表达式,让文本框只能输入数字和字母,最大长度5位
    打开office2010里面的access,总是提示要配置Office single image
    ghost 还原系统时,遇到error 10010,提示can not open image file
    C# 从excel里面复制的1万6千多条记录粘贴到FCKeditor里面,点保存的时候,保存不了,页面没有反应
    sqlserver中,查看某个函数的调用情况
    在sqlserver存储过程中给in参数传带逗号值的办法,如传'1','2','3'这样的
    sd_cms置顶新闻,背景颜色突击显示
    【一起学源码-微服务】Ribbon 源码二:通过Debug找出Ribbon初始化流程及ILoadBalancer原理分析
  • 原文地址:https://www.cnblogs.com/brady-wang/p/13369613.html
Copyright © 2020-2023  润新知