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

Submitted by Nikita Spiridonov on April 21, 2016, 12:46 p.m.

Details

Message ID 1461242792-635567-2-git-send-email-nspiridonov@virtuozzo.com
State New
Series "improve p.haul logging"
Headers show

Commit Message

Nikita Spiridonov April 21, 2016, 12:46 p.m.
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@virtuozzo.com>
---
 p.haul         |    5 +++--
 p.haul-service |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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