[tor-commits] [stem/master] Only logging an init message when repeating

atagar at torproject.org atagar at torproject.org
Fri Dec 14 17:00:46 UTC 2012


commit 85241a8cdb145edce2655dda69d2c822276095a1
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Dec 14 08:59:16 2012 -0800

    Only logging an init message when repeating
    
    I'm about to change the republication script to be a cron process rather than a
    daemon, but first I want to drop its initializtion log message when running in
    a one-off fasion. Otherwise we'll get a log entry every five minutes for it.
---
 docs/republish.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/republish.py b/docs/republish.py
index 70cd50e..1d2d249 100644
--- a/docs/republish.py
+++ b/docs/republish.py
@@ -7,7 +7,7 @@ import time
 LOGGER = logging.getLogger("republish")
 LOGGER.setLevel(logging.INFO)
 
-handler = logging.FileHandler('/home/stem/site_republishing.log')
+handler = logging.FileHandler('/home/stem/republish.log')
 handler.setFormatter(logging.Formatter(
   fmt = '%(asctime)s [%(levelname)s] %(message)s',
   datefmt = '%m/%d/%Y %H:%M:%S',
@@ -53,7 +53,6 @@ if __name__ == '__main__':
     print "%s (for usage provide --help)" % exc
     sys.exit(1)
   
-  LOGGER.log(logging.INFO, "Starting stem site republisher")
   repeat_rate = None
   
   for opt, arg in opts:
@@ -68,6 +67,7 @@ if __name__ == '__main__':
       sys.exit()
   
   if repeat_rate:
+    LOGGER.log(logging.INFO, "Starting stem site republisher")
     latest_run = 0 # unix timestamp for when we last ran
     
     while True:



More information about the tor-commits mailing list