From f7406b9c7daa0d00ea35e2f08a45fcdf25db71ec Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 11 Apr 2013 14:06:03 -0400 Subject: [PATCH] Don't write logs to the server's working directory when DEPLOYED. Otherwise these logs will end up all getting split up when we switch to the new deployment model. (imported from commit 0514c296470be7113cab6c2f48e8dd33f1b9353d) --- humbug/settings.py | 6 ++++-- zephyr/lib/stats.py | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/humbug/settings.py b/humbug/settings.py index b04267c777..74474c9771 100644 --- a/humbug/settings.py +++ b/humbug/settings.py @@ -333,8 +333,12 @@ CACHES['database'] = { if DEPLOYED: SERVER_LOG_PATH = "/home/humbug/logs/server.log" + EVENT_LOG_DIR = '/home/humbug/logs/event_log' + STATS_DIR = '/home/humbug/stats' else: + EVENT_LOG_DIR = 'event_log' SERVER_LOG_PATH = "server.log" + STATS_DIR = 'stats' LOGGING = { 'version': 1, @@ -437,8 +441,6 @@ OPENID_RENDER_FAILURE = openid_failure_handler MAILCHIMP_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-us4' HUMBUG_FRIENDS_LIST_ID = '84b2f3da6b' -EVENT_LOG_DIR = 'event_log' - # Client-side polling timeout for get_events, in milliseconds. # We configure this here so that the client test suite can override it. # We already kill the connection server-side with heartbeat events, diff --git a/zephyr/lib/stats.py b/zephyr/lib/stats.py index 2e27a658b8..6c48fd1e03 100644 --- a/zephyr/lib/stats.py +++ b/zephyr/lib/stats.py @@ -1,15 +1,14 @@ +from django.conf import settings import os import logging -STATS_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "stats") - def update_stat(name, value): try: - os.mkdir(STATS_DIR) + os.mkdir(settings.STATS_DIR) except OSError: pass - base_filename = os.path.join(STATS_DIR, name) + base_filename = os.path.join(settings.STATS_DIR, name) tmp_filename = base_filename + ".new" try: