6.5. Configuring debug

The codebase uses 2 logging streams:

  • db
    • Logging from the DB.
  • api
    • logging from the api.

Configuration is defined in settings.yml, using a wrapper for Mononlog. The reason for the wrapper, is so that we can define the db and api logging streams in the same object, and provide the same configurability that Mononlog provides. The two logging streams can then be confiured to use as many handlers and formatters as you wish.

6.5.1. Debugging configuration

This is done in the debug section in settings.yml.

6.5.1.1. Formatters

A default formatter is provided in debug.formatters, but you can add as many as you like. These define the log message layout.

6.5.1.2. Handlers

Sample handlers are provided in example.settings.yml.

You can use a single handler (to send db and api logs to the same file or DB table for example ), or multiple handlers if you want to send the logging to multiple handlers.

6.5.1.2.1. Setting verbosity levels

In the level attribute, set the value to:

  • DEBUG: Detailed debug information.
  • INFO: Interesting events. Examples: User logs in, SQL logs.
  • NOTICE: Normal but significant events.
  • WARNING: Exceptional occurrences that are not errors. Examples: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
  • ERROR: Runtime errors that do not require immediate action but should typically be logged and monitored.
  • CRITICAL: Critical conditions. Example: Application component unavailable, unexpected exception.
  • ALERT: Action must be taken immediately. Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
  • EMERGENCY: Emergency: system is unusable.

6.5.1.3. Assigning handlers to logging streams

This is done the debug.loggers section. assign as many handlers as you like to the db and api loggers.

6.5.2. Links