Skip to content

Commit 6c71455

Browse files
Merge pull request #100 from timvaillancourt/MCB_1.0-bugfix-v11
MCB_1.0: Make a new log file per backup name
2 parents b6e29a4 + 442c783 commit 6c71455

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

mongodb_consistent_backup/Logger.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class Logger:
88
def __init__(self, config, backup_time):
99
self.config = config
10+
self.backup_name = self.config.backup.name
1011
self.backup_time = backup_time
1112

1213
self.log_level = logging.INFO
@@ -28,8 +29,8 @@ def start(self):
2829
try:
2930
logging.basicConfig(level=self.log_level, format=self.log_format)
3031
if self.do_file_log:
31-
self.current_log_file = os.path.join(self.config.log_dir, "backup.log")
32-
self.backup_log_file = os.path.join(self.config.log_dir, "backup.%s.log" % self.backup_time)
32+
self.current_log_file = os.path.join(self.config.log_dir, "backup.%s.log" % self.backup_name)
33+
self.backup_log_file = os.path.join(self.config.log_dir, "backup.%s.%s.log" % (self.backup_name, self.backup_time))
3334
self.file_log = logging.FileHandler(self.backup_log_file)
3435
self.file_log.setLevel(self.log_level)
3536
self.file_log.setFormatter(logging.Formatter(self.log_format))

mongodb_consistent_backup/Oplog/Tailer/TailThread.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
class TailThread(Process):
18-
def __init__(self, do_stop, uri, config, timer, oplog_file, state, dump_gzip=False, status_secs=30):
18+
def __init__(self, do_stop, uri, config, timer, oplog_file, state, dump_gzip=False):
1919
Process.__init__(self)
2020
self.do_stop = do_stop
2121
self.uri = uri
@@ -24,7 +24,7 @@ def __init__(self, do_stop, uri, config, timer, oplog_file, state, dump_gzip=Fal
2424
self.oplog_file = oplog_file
2525
self.state = state
2626
self.dump_gzip = dump_gzip
27-
self.status_secs = status_secs
27+
self.status_secs = self.config.oplog.tailer.status_interval
2828
self.status_last = time()
2929

3030
self.timer_name = "%s-%s" % (self.__class__.__name__, self.uri.replset)

mongodb_consistent_backup/Oplog/Tailer/Tailer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def run(self):
5454
self.timer,
5555
oplog_file,
5656
oplog_state,
57-
self.do_gzip(),
58-
self.status_secs
57+
self.do_gzip()
5958
)
6059
self.shards[shard] = {
6160
'stop': stop,

0 commit comments

Comments
 (0)