Log file cleanup + improvements

-Don't show queue timeout as error
-Show UTC time and current timezone on pypo startup
This commit is contained in:
Martin Konecny 2012-06-28 12:12:22 -04:00
parent 263ba02481
commit 7f735fe2fa
2 changed files with 13 additions and 1 deletions

View File

@ -2,8 +2,10 @@
Python part of radio playout (pypo) Python part of radio playout (pypo)
""" """
import time
from optparse import OptionParser from optparse import OptionParser
from datetime import datetime
import time
import sys import sys
import signal import signal
import logging import logging
@ -124,6 +126,12 @@ if __name__ == '__main__':
logger.info('# Liquidsoap Scheduled Playout System #') logger.info('# Liquidsoap Scheduled Playout System #')
logger.info('###########################################') logger.info('###########################################')
#Although all of our calculations are in UTC, it is useful to know what timezone
#the local machine is, so that we have a reference for what time the actual
#log entries were made
logger.info("Timezone: %s" % time.tzname)
logger.info("UTC time: %s" % datetime.utcnow())
signal.signal(signal.SIGINT, keyboardInterruptHandler) signal.signal(signal.SIGINT, keyboardInterruptHandler)
# initialize # initialize

View File

@ -9,6 +9,8 @@ import telnetlib
import copy import copy
from threading import Thread from threading import Thread
from Queue import Empty
from api_clients import api_client from api_clients import api_client
from std_err_override import LogWriter from std_err_override import LogWriter
@ -493,6 +495,8 @@ class PypoFetch(Thread):
message = self.fetch_queue.get(block=True, timeout=self.listener_timeout) message = self.fetch_queue.get(block=True, timeout=self.listener_timeout)
self.handle_message(message) self.handle_message(message)
except Empty, e:
self.logger.info("Queue timeout. Fetching schedule manually")
except Exception, e: except Exception, e:
import traceback import traceback
top = traceback.format_exc() top = traceback.format_exc()