mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 23:19:10 +00:00
logging: Stop having create_logger force loglevels to INFO.
This is already the loglevel we set on the root logger, so this has no effect -- except in tests, where `test_settings.py` attempts to set some of these same loggers to higher loglevels. Because the `create_logger` call generally runs after we've configured settings, it clobbers that effect. The code in `test_settings.py` that tries to suppress logs only works because it also sets `propagate=False`, which has nothing to do with loglevels but does cause logs at this logger (and descendants) to be dropped completely unless we've configured handlers for this logger (or one of its relevant descendants.)
This commit is contained in:
@@ -19,7 +19,7 @@ from zerver.models import Message, Realm, RealmAuditLog, \
|
||||
|
||||
## Logging setup ##
|
||||
|
||||
logger = create_logger('zulip.management', settings.ANALYTICS_LOG_PATH, 'INFO')
|
||||
logger = create_logger('zulip.management', settings.ANALYTICS_LOG_PATH)
|
||||
|
||||
# You can't subtract timedelta.max from a datetime, so use this instead
|
||||
TIMEDELTA_MAX = timedelta(days=365*1000)
|
||||
|
||||
@@ -187,7 +187,7 @@ class ZulipFormatter(logging.Formatter):
|
||||
|
||||
def create_logger(name: str,
|
||||
log_file: str,
|
||||
log_level: str,
|
||||
log_level: Optional[str]=None,
|
||||
log_format: str="%(asctime)s%(levelname)-8s%(message)s") -> Logger:
|
||||
"""Creates a named logger for use in logging content to a certain
|
||||
file. A few notes:
|
||||
@@ -200,6 +200,8 @@ def create_logger(name: str,
|
||||
"""
|
||||
logging.basicConfig(format=log_format)
|
||||
logger = logging.getLogger(name)
|
||||
|
||||
if log_level is not None:
|
||||
logger.setLevel(getattr(logging, log_level))
|
||||
|
||||
if log_file:
|
||||
|
||||
@@ -17,7 +17,7 @@ from zerver.lib.logging_util import create_logger
|
||||
|
||||
## Logging setup ##
|
||||
|
||||
logger = create_logger('zulip.send_email', settings.EMAIL_LOG_PATH, 'INFO')
|
||||
logger = create_logger('zulip.send_email', settings.EMAIL_LOG_PATH)
|
||||
|
||||
class FromAddress:
|
||||
SUPPORT = parseaddr(settings.ZULIP_ADMINISTRATOR)[1]
|
||||
|
||||
@@ -10,7 +10,7 @@ from typing import DefaultDict, List, Union, Any
|
||||
from zerver.models import UserProfile, UserMessage, RealmAuditLog, \
|
||||
Subscription, Message, Recipient, UserActivity, Realm
|
||||
|
||||
logger = create_logger("zulip.soft_deactivation", settings.SOFT_DEACTIVATION_LOG_PATH, 'INFO')
|
||||
logger = create_logger("zulip.soft_deactivation", settings.SOFT_DEACTIVATION_LOG_PATH)
|
||||
|
||||
def filter_by_subscription_history(user_profile: UserProfile,
|
||||
all_stream_messages: DefaultDict[int, List[Message]],
|
||||
|
||||
@@ -10,7 +10,7 @@ from zerver.models import UserProfile
|
||||
from zproject.backends import ZulipLDAPUserPopulator
|
||||
|
||||
## Setup ##
|
||||
logger = create_logger(__name__, settings.LDAP_SYNC_LOG_PATH, 'INFO')
|
||||
logger = create_logger(__name__, settings.LDAP_SYNC_LOG_PATH)
|
||||
|
||||
# Run this on a cronjob to pick up on name changes.
|
||||
def sync_ldap_user_data() -> None:
|
||||
|
||||
Reference in New Issue
Block a user