Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion liveMonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ukmonPostProc import setupLogging


log = logging.getLogger()
log = logging.getLogger("ukmonlogger")

timetowait = 30 # seconds to wait for a new line before deciding the log is stale

Expand Down
2 changes: 1 addition & 1 deletion sendToLive.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from RMS.Formats.FieldIntensities import readFieldIntensitiesBin


log = logging.getLogger("logger")
log = logging.getLogger("ukmonlogger")


def getBlockBrightness(dirpath, filename):
Expand Down
2 changes: 1 addition & 1 deletion ukmonInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from RMS.Misc import isRaspberryPi
from uploadToArchive import readIniFile

log = logging.getLogger()
log = logging.getLogger("ukmonlogger")
log.setLevel(logging.WARNING)

oldip = '3.9.65.98'
Expand Down
5 changes: 4 additions & 1 deletion ukmonPostProc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@

from uploadToArchive import uploadToArchive, readIniFile

log = logging.getLogger()
log = logging.getLogger("ukmonlogger")
log.setLevel(logging.INFO)


def setupLogging(logpath, prefix):
print('about to initialise logger')
logdir = os.path.expanduser(logpath)
os.makedirs(logdir, exist_ok=True)
log.info('removing any existing log handlers')
for handler in log.handlers[:]:
log.removeHandler(handler)

logfilename = os.path.join(logdir, prefix + datetime.datetime.now(datetime.timezone.utc).strftime('%Y%m%d_%H%M%S.%f') + '.log')
handler = logging.handlers.TimedRotatingFileHandler(logfilename, when='D', interval=1)
Expand Down
10 changes: 5 additions & 5 deletions uploadToArchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
import tempfile
from RMS.Formats.FTPdetectinfo import readFTPdetectinfo

log = logging.getLogger("logger")
log = logging.getLogger("ukmonlogger")


def readKeyFile(filename, inifvals):
if not os.path.isfile(filename):
log.error('Config file missing, cannot continue')
log.error('Keyfile {} not downloaded. Check ssh key and station location with ukmon team.'.format(filename))
return False
with open(filename, 'r') as fin:
lis = fin.readlines()
Expand Down Expand Up @@ -90,7 +90,7 @@ def getAWSKey(inifvals):
handle, tmpfnam = tempfile.mkstemp()
ftp_client.get(inifvals['LOCATION']+'.csv', tmpfnam)
except Exception as e:
log.error('unable to find AWS key')
log.error('unable to find AWS key, check location in ukmon.ini')
log.info(e, exc_info=True)
ftp_client.close()
try:
Expand All @@ -99,7 +99,7 @@ def getAWSKey(inifvals):
os.remove(tmpfnam)
key, sec = lis[1].split(',')
except Exception as e:
log.error('malformed AWS key')
log.error('malformed AWS key, contact support')
log.info(e, exc_info=True)
except Exception as e:
log.error('unable to retrieve AWS key')
Expand All @@ -114,7 +114,7 @@ def getAWSKey(inifvals):

def readIniFile(filename):
if not os.path.isfile(filename):
log.error('ukmon.ini missing, cannot continue')
log.error('{} missing, cannot continue'.format(filename))
return False
with open(filename, 'r') as fin:
lis = fin.readlines()
Expand Down