Announcement

Collapse
No announcement yet.

Using Monolog Handler for logging

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #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.

    Comment


    • #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


      • #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.

        Comment

        Working...
        X