Set min channel log rotate size to 1kB. Resolve #2702
This commit is contained in:
parent
9a2a3fc2cb
commit
f3182b0dae
2 changed files with 4 additions and 3 deletions
|
|
@ -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")
|
LOCKWARNING_LOG_FILE = os.path.join(LOG_DIR, "lockwarnings.log")
|
||||||
# Number of lines to append to rotating channel logs when they rotate
|
# Number of lines to append to rotating channel logs when they rotate
|
||||||
CHANNEL_LOG_NUM_TAIL_LINES = 20
|
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
|
CHANNEL_LOG_ROTATE_SIZE = 1000000
|
||||||
# Unused by default, but used by e.g. the MapSystem contrib. A place for storing
|
# 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
|
# semi-permanent data and avoid it being rebuilt over and over. It is created
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,7 @@ class EvenniaLogFile(logfile.LogFile):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
_CHANNEL_LOG_NUM_TAIL_LINES = settings.CHANNEL_LOG_NUM_TAIL_LINES
|
_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):
|
def rotate(self, num_lines_to_append=None):
|
||||||
"""
|
"""
|
||||||
|
|
@ -463,7 +463,7 @@ def _open_log_file(filename):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
_LOGDIR = settings.LOG_DIR
|
_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)
|
filename = os.path.join(_LOGDIR, filename)
|
||||||
if filename in _LOG_FILE_HANDLES:
|
if filename in _LOG_FILE_HANDLES:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue