Monolog

Commerce 2 complies with the PSR-3 standard. By default, Commerce uses Monolog. Monolog implemented as a preference for Psr\Log\LoggerInterface in the Commerce application di.xml.

Monolog is a popular PHP logging solution with a wide range of handlers that enable you to build advanced logging strategies. Following is a summary of how Monolog works.

A Monolog logger is a channel that has its own set of handlers. Monolog has many handlers, including:

  • Log to files and syslog
  • Send alerts and e-mails
  • Log specific servers and networked logging
  • Logging in development (integration with FireBug and Chrome Logger, among others)
  • Log to the database

Each handler can either process the input message and stop propagation or pass the control to the next handler in a chain.

Log messages can be processed in many different ways. For example, you can store all debug information into a file on disk, put the messages with higher log levels into a database, and finally send messages with log level “critical” by e-mail.

Other channels can have a different set of handlers and logic.

Previous pageConfigure a custom cron job
Next pageLogger interface

Commerce