diff --git a/evennia/settings_default.py b/evennia/settings_default.py index a4ad4fbf8d..497f8661d2 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -153,7 +153,8 @@ HTTP_LOG_FILE = os.path.join(LOG_DIR, "http_requests.log") LOCKWARNING_LOG_FILE = os.path.join(LOG_DIR, "lockwarnings.log") # Number of lines to append to rotating channel logs when they rotate CHANNEL_LOG_NUM_TAIL_LINES = 20 -# Max size (in bytes) of channel log files before they rotate +# Max size (in bytes) of channel log files before they rotate. +# Minimum is 1000 (1kB) but should usually be larger. CHANNEL_LOG_ROTATE_SIZE = 1000000 # Unused by default, but used by e.g. the MapSystem contrib. A place for storing # semi-permanent data and avoid it being rebuilt over and over. It is created diff --git a/evennia/utils/logger.py b/evennia/utils/logger.py index 9e81b2b5b0..ff01e28555 100644 --- a/evennia/utils/logger.py +++ b/evennia/utils/logger.py @@ -384,7 +384,7 @@ class EvenniaLogFile(logfile.LogFile): from django.conf import settings _CHANNEL_LOG_NUM_TAIL_LINES = settings.CHANNEL_LOG_NUM_TAIL_LINES - num_lines_to_append = _CHANNEL_LOG_NUM_TAIL_LINES + num_lines_to_append = max(1, _CHANNEL_LOG_NUM_TAIL_LINES) def rotate(self, num_lines_to_append=None): """ @@ -463,7 +463,7 @@ def _open_log_file(filename): from django.conf import settings _LOGDIR = settings.LOG_DIR - _LOG_ROTATE_SIZE = settings.CHANNEL_LOG_ROTATE_SIZE + _LOG_ROTATE_SIZE = max(1000, settings.CHANNEL_LOG_ROTATE_SIZE) filename = os.path.join(_LOGDIR, filename) if filename in _LOG_FILE_HANDLES: