From ba0ba71bf49afb96e71d3cacc3fde4f423de34ed Mon Sep 17 00:00:00 2001 From: Richard Esplin Date: Wed, 15 Jan 2014 16:15:11 -0700 Subject: [PATCH] Eliminate unnecessary closing of the log file. Name returns a string that is the log file name: the channel plus the timestamp. But on my system log.name returns the fully qualified path to the currently open file. This is because log is a file handle, so if you declare it with a path, it will be included in the name. On systems were logging is not in the current directory, the two will never match, and the file is closed and then reopened. Only taking the basename solves this problem. --- plugins/ChannelLogger/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ChannelLogger/plugin.py b/plugins/ChannelLogger/plugin.py index 43d9a1175..b1a6f6e9c 100644 --- a/plugins/ChannelLogger/plugin.py +++ b/plugins/ChannelLogger/plugin.py @@ -132,7 +132,7 @@ class ChannelLogger(callbacks.Plugin): for (channel, log) in logs.items(): if self.registryValue('rotateLogs', channel): name = self.getLogName(channel) - if name != log.name: + if name != os.path.basename(log.name): log.close() del logs[channel]