Skip to content

Logging

This section describes logging configuration, that can be applied for below Lime-CRM server services:

  • Web Server
  • Search Indexer
  • Event Handler
  • Task Handler
  • Task Scheduler
  • Importer

Logging can be configured through environmental variables and the service configuration. Environmental variables take precedence over the service configuration.

Configuration

As a result, the root logger is configured.

Environmental Variable Configuration key
(under logging section)
Description Default value
LOGLEVEL level Sets the logging level. Accepted values are: DEBUG, INFO, WARNING, ERROR, CRITICAL. WARNING
N/A loggers Fine-tunes logging level. See below. Only available in configuration file. None
LIME_LOG_STDOUT_HANDLER stdout_handler Indicates whether log messages should be printed to the standard output (usually console). True
LIME_LOG_STDOUT_HANDLER_JSON_FORMAT stdout_handler_json_format Indicates whether log messages printed to the standard output should be json-formatted. False
LIME_LOG_ROTATING_FILE_HANDLER rotating_file_handler Indicates whether log messages should be saved to a file that is being rotated, based on its size. False
LIME_LOG_ROTATING_FILE_NAME rotating_file_name Sets a name for the rotating file. logs.log
LIME_LOG_ROTATING_FILE_MAX_SIZE rotating_file_max_size Sets a maximum size of the rotating file, in megabytes. 10
LIME_LOG_ROTATING_FILE_BACKUP_COUNT rotating_file_backup_count Sets a maximum number of rotating files. 10
LIME_LOG_ROTATING_JSON_FILE_HANDLER rotating_json_file_handler Indicates whether log messages should be saved to a json file that is being rotated, based on its size. False
LIME_LOG_ROTATING_JSON_FILE_NAME rotating_json_file_name Sets a name for the rotating json file. logs.json.log
LIME_LOG_ROTATING_JSON_FILE_MAX_SIZE rotating_json_file_max_bytes Sets a maximum size of the rotating json file, in megabytes. 10
LIME_LOG_ROTATING_JSON_FILE_BACKUP_COUNT rotating_json_file_backup_count Sets a maximum number of rotating json files. 10
LIME_LOG_TIMED_ROTATING_FILE_HANDLER timed_rotating_file_handler Indicates whether log messages should be saved to a file that is being periodically rotated. False
LIME_LOG_TIMED_ROTATING_FILE_NAME timed_rotating_file_name Sets a name for the timed rotating file. logs-timed.log
LIME_LOG_TIMED_ROTATING_FILE_INTERVAL timed_rotating_file_interval Sets an interval (in minutes) for the timed rotating file, after which a new file will be created. 60
LIME_LOG_TIMED_ROTATING_FILE_BACKUP_COUNT timed_rotating_file_backup_count Sets a maximum number of timed rotating files. 6
LIME_LOG_REDIRECT_STDOUT redirect_stdout Indicates whether messages from standard output (like prints) should be redirected to the logger. False

Fine-Tuning Log Levels

To adjust the logging levels for specific parts of the product, use the loggers subsection within the logging section of your service configuration.

Example Configuration

logging:
  loggers:
    werkzeug:
      level: ERROR
    lime_database:
      level: DEBUG
    sqlalchemy:
      level: DEBUG

This configuration does the following:

  • Suppresses request logging from the werkzeug package.
  • Enables debug-level logging for the lime_database package.
  • Outputs detailed information about SQL connection management and SQL statements from sqlalchemy.

You can fine-tune the log output further by using more specific logger names. These names are visible in the log output itself.

Example Log Output

2025-06-20 09:22:22,691: DEBUG: sqlalchemy.engine.Engine ...
2025-06-20 09:22:22,705: DEBUG: sqlalchemy.pool.impl.QueuePool ...

To enable debug logging only for SQL connection pooling, and reduce verbosity elsewhere, you can use:

logging:
  loggers:
    sqlalchemy:
      level: WARN
    sqlalchemy.pool:
      level: DEBUG

For more details on the loggers syntax, refer to the Python logging configuration documentation.