How to save process clients cron output

2020.11 and newer

Note that starting from version 2020.11.0 Fleio automatically saves logs for all periodic tasks on FLEIO_ACTIVITY level. These logs can be viewed in staff panel, “Utilities” > “Periodic task log” or “Activity log” section.

2020.09 and 2020.10

You need to remove the comments for the following code in /var/webapps/fleio/project/fleio/fleiosettings/settings.py:

# CRON_LOG_DIR = '/var/log/fleio/cronlog'
# if not os.path.isdir(CRON_LOG_DIR):
#     parent_dir = os.path.dirname(CRON_LOG_DIR)
#     parent_stat = os.stat(parent_dir)
#     os.mkdir(CRON_LOG_DIR, 0o755)
#     stats = os.stat(CRON_LOG_DIR)
#     if stats.st_uid != parent_stat.st_uid:
#         os.chown(CRON_LOG_DIR, parent_stat.st_uid, parent_stat.st_gid)
# LOGGING['handlers']['process_clients_log'] = {
#     'class': 'logging.handlers.RotatingFileHandler',
#     'formatter': 'detailed',
#     'filename': '{}/process_clients'.format(CRON_LOG_DIR),
#     'maxBytes': 10 * 1024 * 1024,
#     'backupCount': 10,
# }
# LOGGING['loggers']['cron'] = {
#     'level': 'INFO',
#     'filters': {},
#     'handlers': ['process_clients_log'],
# }

After that you need to restart Fleio and Celery for the changes to take effect:

service fleio restart
service uwsgi-fleio restart
service celery restart

2020.08.1 and older

You need to add the following code in /var/webapps/fleio/project/fleio/fleiosettings/settings.py:

CRON_LOG_DIR = '/var/log/fleio/cronlog'
if not os.path.isdir(CRON_LOG_DIR):
    parent_dir = os.path.dirname(CRON_LOG_DIR)
    parent_stat = os.stat(parent_dir)
    os.mkdir(CRON_LOG_DIR, 0o755)
    stats = os.stat(CRON_LOG_DIR)
    if stats.st_uid != parent_stat.st_uid:
        os.chown(CRON_LOG_DIR, parent_stat.st_uid, parent_stat.st_gid)
LOGGING['handlers']['process_clients_log'] = {
    'class': 'logging.handlers.RotatingFileHandler',
    'formatter': 'detailed',
    'filename': '{}/process_clients'.format(CRON_LOG_DIR),
    'maxBytes': 10 * 1024 * 1024,
    'backupCount': 10,
}
LOGGING['loggers']['cron'] = {
    'level': 'INFO',
    'filters': {},
    'handlers': ['process_clients_log'],
}

After that you need to restart Fleio and Celery for the changes to take effect:

service fleio restart
service uwsgi-fleio restart
service celery restart