silverstripe / cwp-core

CWP basic compatibility module
BSD 3-Clause "New" or "Revised" License
3 stars 12 forks source link

Missing logging in 2.x branch means no logs make it to Graylog #43

Closed madmatt closed 6 years ago

madmatt commented 6 years ago

CWP provides the Graylog service for developers to record errors in. cwp-core previously in the 1.x line automatically logged messages into Graylog, but the 2.x line seems to have lost this.

Here's what I added to a project to bring this back, using the same SilverStripe_log facility that I believe was used previously.

In a new file, e.g. mysite/_config/logging.yml:

SilverStripe\Core\Injector\Injector:
  Psr\Log\LoggerInterface:
    calls:
      SyslogHandler: [ pushHandler, [ %$SyslogHandler ] ]
  SyslogHandler:
    class: Monolog\Handler\SyslogHandler
    constructor:
      - 'SilverStripe_log'

This is enough to push log messages through to CWP's Graylog system.

robbieaverill commented 6 years ago

Thanks @madmatt, I've tested your fix and it's good. I've adjusted the names used slightly and made a PR for it at #44

ScopeyNZ commented 6 years ago

Closed by #44

madmatt commented 6 years ago

Thanks for the super-fast fix team!