From c50be7c3f26b6488497003504d03302949fe2091 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 28 Sep 2015 10:40:48 -0400 Subject: [PATCH] Change rollover event to be JSON The log format for other pieces of data is JSON. Change the rollover event to be consistent. Also do not record the previous name of the log file, as that isn't used, and the current filename is likely to change when it too gets rolled over so there's no practical use of knowing the no longer valid name for the transaction. --- confluent_server/confluent/log.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/log.py b/confluent_server/confluent/log.py index 29b291cd..8d58033f 100644 --- a/confluent_server/confluent/log.py +++ b/confluent_server/confluent/log.py @@ -551,7 +551,7 @@ class Logger(object): # which cause the rolling event. to_bfile, to_tfile = files self.logentries.appendleft(entry) - roll_data = "rename:%s>%s" % (self.handler.textpath, to_tfile) + roll_data = json.dumps({'previouslogfile': to_tfile}) self.logentries.appendleft([DataTypes.event, tstamp, roll_data, Events.logrollover, None]) self._lock(fcntl.LOCK_UN) @@ -563,7 +563,7 @@ class Logger(object): def parse_last_rolling_files(textfile, offset, datalen): textfile.seek(offset, 0) - textpath = textfile.read(datalen).split('>')[1] + textpath = json.loads(textfile.read(datalen))['previouslogfile'] dir_name, base_name = os.path.split(textpath) temp = base_name.split('.') temp.insert(1,'cbl')