1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PSR3-compatible generic logging facility

Discussion in 'XenForo Suggestions' started by Sim, Mar 4, 2015.

  1. Sim

    Sim Well-Known Member

    I think a generic activity log (with admin UI) which implements the PSR-3 logging interface would be very useful as part of the core.

    Add-ons can then log activity and errors there for the administrators to monitor.

    Add-ons can choose which log level to send - for example informational updates (eg "X number of emails sent by this cron entry") or debugging ("output from this SOAP call").

    The logging facility would implement the standard PSR-3 log levels (emergency, alert, critical, error, warning, notice, info, debug) and the UI would allow filtering log messages by date, PSR-3 log level and/or add-on id.

    Also, the administrator would be able to set a minimum log level to actually get stored (eg only warning and above), so that spurious debug and info logs don't fill up the database on production servers.

    Add-on developers could also potentially extend the capabilities of this core logging facility to send log information to external application monitoring systems (eg New Relic) or even just to notification systems (HipChat, Slack, etc).

    Implementing a PSR-3 interface would also allow us to wire external packages (eg payment gateways, integration libraries, etc) to the logging system such that any log messages they send will automatically end up in the XenForo log - even if those packages were not built with XenForo in mind.
    GliX, tyteen4a03, Mouth and 1 other person like this.
  2. Sim

    Sim Well-Known Member

    As a further suggestion - pulling in the excellent Monolog logging library (MIT licensed) to be part of the XenForo core would provide most of the base functionality required here - including a standard interface, the ability to wire other packages in, multiple input channels, multiple destination handlers - including the ability to extend the built in functionality with custom handlers.

    The base implementation would log directly to the database, while add-on developers could easily extend the functionality to provide additional handlers for other logging destinations.

    For example, I'd love the ability to be able to redirect (or supplement) server error logs to an external monitoring application for direct alerting (eg a HipChat message or an SMS message) - Monolog as part of the core would allow for this without that much additional work by an add-on developer.

Share This Page