Documentation

Logging

Configuring the Site Logging

The logging levels can be configured on a per-site basis, e.g.

<logging>
  <!-- 
      Enable DEBUG logging level for anything other than production.  
      In production use INFO logging level
   -->
  <priority value="DEBUG" expr="!profile.prod" showLocation="true"/>
  <priority value="INFO" expr="profile.prod"/>
</logging>

This configuration enabled INFO logging in production, but in non-production environments log at DEBUG level and show the location of where the log message came from (i.e. plugin name and line number).

The following enables trace logging:

<logging>
  <priority value="TRACE" expr="!profile.prod" showLocation="true"/>
</logging>

Supported priority levels are:

  • ERROR
  • WARN
  • INFO
  • DEBUG
  • TRACE

Logging a Message in a Plugin

You can use the site logger within your plugin as follows:

import com.bemoko.live.platform.Bemoko

class Api {
  def log = Bemoko.log

  void execute(Map p) {
    if (log.debugEnabled) {
      log.debug("Executing plugin : ${this} : ${Bemoko.device.vendorModel}")
    }
  }
}

Platform logging

Note that the site logging builds on top of platform logging


More