Countly has a centralized logging system. This system ensures consistent logging across various components and the ability to alter the behavior of loggers at run time.

To use Countly logging, you need to:

  1. Instantiate a logger by calling common.log("LOGGER_NAME") where common is a api/utils/common.js module. Instead of LOGGER_NAME you need to supply your plugin name followed by plugin component name: "pluginname" or "pluginname:api".
  2. Call one of the logger's functions: d, i, w, e. Each function represents a distinct logging level: DEBUG, INFO, WARNING, ERROR respectively. Arguments of those functions are the same as console.log has.

Here is an example of a typical plugin:

var plugin = {},
    common = require('../../../api/utils/common.js'),
    log = common.log('pluginname:api'),
    plugins = require('../../pluginManager.js');

(function () {

	plugins.register('/i', function(ob){
		var params = ob.params;
		log.i('myPlugin got a request: %j', params.qstring);


Logging configuration

Main logging configuration is in the Configuration section under Top Cog menu:


Logging configuration consists of comma-separated list of logger names for each logging level. Default value is a logging level for loggers that are not listed in the config. To overwrite logging level WARNING for module api and to set it to DEBUG, for instance, you'll need to replace pluginname:api on the screenshot above with pluginname:api, api. This will automatically enable all api:XXX loggers as well unless some of them have different log levels in the configuration.

Also note, that due to the fact that this configuration is not available on Countly startup, default logging configuration must be supplied to config.js as well. config.js preferences are used on startup and then get replaced by shared configuration stored in Mongodb:

var countlyConfig = {
    logging: {
        info: ["jobs"],
        default: "warning"

module.exports = countlyConfig;

Looking for help?