2016-04-07 15:03:22 +02:00
|
|
|
#!/usr/bin/env python
|
2013-11-19 00:04:45 +01:00
|
|
|
import sys
|
|
|
|
import logging
|
|
|
|
import os
|
2016-06-25 17:07:13 +02:00
|
|
|
from os.path import dirname, abspath
|
|
|
|
|
|
|
|
BASE_DIR = dirname(dirname(dirname(abspath(__file__))))
|
|
|
|
sys.path.append(BASE_DIR)
|
|
|
|
import scripts.lib.setup_path_on_import
|
|
|
|
|
2013-11-19 00:04:45 +01:00
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
|
|
|
|
from django.conf import settings
|
|
|
|
|
|
|
|
logger = logging.getLogger("zulip.management")
|
2016-12-16 19:59:52 +01:00
|
|
|
if not os.path.exists(settings.MANAGEMENT_LOG_PATH):
|
|
|
|
dir = os.path.dirname(settings.MANAGEMENT_LOG_PATH)
|
|
|
|
if not os.path.exists(dir):
|
|
|
|
os.makedirs(dir)
|
|
|
|
|
2013-11-19 00:04:45 +01:00
|
|
|
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],))
|