From abb5a104d95f62058b7429b3640ead7fd29df2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Thu, 16 Feb 2017 09:38:42 +0100 Subject: [PATCH] Fix logging to file in the current directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously if you ran 'tuned -l log', it would crash with: OSError: [Errno 2] No such file or directory: '' This patch fixes the bug. Signed-off-by: Ondřej Lysoněk --- tuned/logs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tuned/logs.py b/tuned/logs.py index 6cc6956..eb8b7a4 100644 --- a/tuned/logs.py +++ b/tuned/logs.py @@ -74,6 +74,8 @@ class TunedLogger(logging.getLoggerClass()): return log_directory = os.path.dirname(filename) + if log_directory == '': + log_directory = '.' if not os.path.exists(log_directory): os.makedirs(log_directory)