Using Monolog Handler for logging

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlexH
    Junior Member
    • Aug 2023
    • 9

    Using Monolog Handler for logging

    Hello,

    I would like to use a logging handler so that specified users are sent logs by email.

    I have read the EspoCRM documentation page on logging (https://docs.espocrm.com/administration/log/), and see that it uses the Monolog library.
    Looking in the Monolog documentation (https://github.com/Seldaek/monolog/b...-processors.md), I would like to use one of the mail handlers, e.g. NativeMailerHandler, possibly with a wrapper.
    I see that the example in the EspoCRM documentation uses the handler at 'Espo\\Core\\Log\\Handler\\EspoRotatingFileHandler ', rather than using a Monolog handler.

    Can you let me know whether and how it is possible to use a Monolog handler?

    Thanks!
  • yuri
    Member
    • Mar 2014
    • 8527

    #2
    Yes. It's stated in the documentation. Espo\\Core\\Log\\Handler\\EspoRotatingFileHandler implements the Monolog handler interface. It's the same as using any monolog handler.

    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • AlexH
      Junior Member
      • Aug 2023
      • 9

      #3
      Thanks, could you please clarify how to use a different Monolog handler, e.g. the NativeMailerHandler? I see that the only handlers at Espo\\Core\\Log\\Handler are EspoFileHandler and EspoRotatingFileHandler.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8527

        #4
        Just need to specify a full PHP class name. Example: https://github.com/espocrm/espocrm/i...ent-1837407174

        You also can pass handler's contructor parameters in params, a key should correspond a constructor parameter name.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        Working...