Logs Settings are part of the Core Settings in Countly. To access them, in the Sidebar, go to Management > Settings, then select Logs from the Core Settings list.
The Logs Settings section allows you to configure the logging levels for different modules of your Countly Server. By adjusting these settings, you can control the verbosity of log output, which is useful for debugging issues, monitoring server health, and managing log file sizes.
Changes to Logs settings require Global Admin privileges. Note that because these settings are not available upon server startup, the default logging configuration must also be supplied in config.js. The config.js preferences are used on startup and then get replaced by the shared configuration stored in MongoDB.
Configuring Module-Level Logging
The module-level logging section allows you to assign specific log levels to individual server modules. Each field accepts a comma-separated list of module names that should output logs at the specified level.
For example, to enable debug-level logging for the API module, add api to the Debug Level field. This will automatically enable all api:XXX sub-loggers as well, unless they have different log levels configured separately.
| Setting | Description |
|---|---|
| Debug Level | A comma-separated list of module names for debug-level logging. Debug logs provide fine-grained informational events that are most useful for debugging an application. This produces the most verbose output. |
| Info Level | A comma-separated list of module names for info-level logging. Info logs record informational messages that highlight the progress of the application during normal operation. |
| Warning Level | A comma-separated list of module names for warning-level logging. Warning logs capture potentially harmful situations that may require attention but do not indicate failure. |
| Error Level | A comma-separated list of module names for error-level logging. Error logs capture error events that might still allow the application to continue running but indicate a problem that should be addressed. |
Setting the Default Log Level
The Default Log Level applies to all modules that are not explicitly listed in any of the module-level fields above. It determines the minimum severity of messages that get written to the log files under the /log directory.
| Setting | Description | Default |
|---|---|---|
|
Default Level Interface |
The default logging level for all modules not explicitly configured. Available options are: Debug, Info, Warning, and Error. | Warning |
Configuring Logs in config.js
Because these settings are not available during server startup, you must also supply default logging preferences in config.js. This ensures proper logging behavior before the MongoDB configuration is loaded. For example:
var countlyConfig = {
...
logging: {
info: ["jobs"],
default: "warning"
}
};
module.exports = countlyConfig;Once the server starts and connects to the database, the settings stored in MongoDB replace the config.js values.
FAQ and Troubleshooting
How do I enable debug logging for a specific module?
Add the module name to the "Debug Level" field. For example, entering api will enable debug logging for the API module and all its sub-loggers. You can list multiple modules by separating them with commas (e.g., api, push, jobs).
How do I reduce log file sizes?
Set the Default Level to "Error" to capture only error-level messages. Remove any module names from the Debug and Info fields. This significantly reduces log output while still capturing critical errors.
Why are my config.js logging settings being overridden?
The config.js logging settings are only used during server startup. Once the server connects to MongoDB, the settings from Management > Settings > Logs take effect. To make permanent changes, update the settings in Countly rather than in config.js.