[CRIU] [PATCH 1/4] p.haul: tweak loggers configuration

Nikita Spiridonov nspiridonov at virtuozzo.com
Thu Apr 21 05:46:29 PDT 2016


Don't overwrite phaul and phaul-service log files - append to the
end instead. Log pid after timestamp for each line.

Signed-off-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
---
 p.haul         |    5 +++--
 p.haul-service |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/p.haul b/p.haul
index cd9d6a7..98560f6 100755
--- a/p.haul
+++ b/p.haul
@@ -29,8 +29,9 @@ def log_uncaught_exception(type, value, traceback):
 args = phaul.args_parser.parse_client_args()
 
 # Configure logging
-logging.basicConfig(filename=args.log_file, filemode="w", level=logging.INFO,
-	format="%(asctime)s.%(msecs)03d: %(message)s", datefmt="%H:%M:%S")
+logging.basicConfig(filename=args.log_file, filemode="a", level=logging.INFO,
+	format="%(asctime)s.%(msecs)03d: %(process)d: %(message)s",
+	datefmt="%H:%M:%S")
 
 # Setup hook to log uncaught exceptions
 sys.excepthook = log_uncaught_exception
diff --git a/p.haul-service b/p.haul-service
index 465e396..b3cbc1c 100755
--- a/p.haul-service
+++ b/p.haul-service
@@ -23,8 +23,9 @@ def fin(foo, bar):
 args = phaul.args_parser.parse_service_args()
 
 # Configure logging
-logging.basicConfig(filename=args.log_file, filemode="w", level=logging.INFO,
-	format="%(asctime)s.%(msecs)03d: %(message)s", datefmt="%H:%M:%S")
+logging.basicConfig(filename=args.log_file, filemode="a", level=logging.INFO,
+	format="%(asctime)s.%(msecs)03d: %(process)d: %(message)s",
+	datefmt="%H:%M:%S")
 
 # Setup hook to log uncaught exceptions
 sys.excepthook = log_uncaught_exception
-- 
1.7.1



More information about the CRIU mailing list