zulip/bin/log-management-command

17 lines
535 B
Python
Executable File

#!/usr/bin/env python
import sys
import logging
import os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
from django.conf import settings
logger = logging.getLogger("zulip.management")
file_handler = logging.FileHandler(settings.MANAGEMENT_LOG_PATH)
formatter = logging.Formatter("%(asctime)s: %(message)s")
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
logger.setLevel(logging.INFO)
logger.info("Ran '%s'" % (sys.argv[1],))