Nir Soffer has uploaded a new change for review.

Change subject: logging: Improve log level alignment
......................................................................

logging: Improve log level alignment

Shorten WARNING to WARN and CRITICAL to CRIT to make log messages align
nicer.

Here is an example log:
https://paste.fedoraproject.org/431570/raw/

Change-Id: Ia18649258f145f974fd4a8f7a96b5849c4a77938
Signed-off-by: Nir Soffer <nsof...@redhat.com>
---
M README.logging
M static/etc/vdsm/logger.conf.in
M tests/run_tests_local.sh.in
M vdsm/vdsm
4 files changed, 13 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/64217/1

diff --git a/README.logging b/README.logging
index ed91532..ca04578 100644
--- a/README.logging
+++ b/README.logging
@@ -26,7 +26,7 @@
 
 # vdsClient [-s] SERVER setLogLevel LEVEL [LOGGER]
 
-`LEVEL` is one of DEBUG, INFO, WARNING
+`LEVEL` is one of DEBUG, INFO, WARN
 `LOGGER` is any logger Vdsm uses. Please check the configuration file
 to learn about some predefined loggers.
 
@@ -43,16 +43,16 @@
 vdsClient -s 0 setLogLevel DEBUG
 
 2. silence virt logs, show only warnings, errors or worse:
-vdsClient -s 0 setLogLevel WARNING virt
+vdsClient -s 0 setLogLevel WARN virt
 
 3. same as #2, for storage
-vdsClient -s 0 setLogLevel WARNING storage
+vdsClient -s 0 setLogLevel WARN storage
 
 4. silence JSONRPC logs:
-vdsClient -s 0 setLogLevel WARNING jsonrpc
+vdsClient -s 0 setLogLevel WARN jsonrpc
 
 5. enable the 'devel' logs, which could be useful for developers
-vdsClient -s 0 setLogLevel devel WARNING
+vdsClient -s 0 setLogLevel devel WARN
 
 
 Notes
diff --git a/static/etc/vdsm/logger.conf.in b/static/etc/vdsm/logger.conf.in
index 02988ff..5e92b78 100644
--- a/static/etc/vdsm/logger.conf.in
+++ b/static/etc/vdsm/logger.conf.in
@@ -61,7 +61,7 @@
 propagate=0
 
 [handler_syslog]
-level=WARNING
+level=WARN
 class=handlers.SysLogHandler
 formatter=sysform
 args=('/dev/log', handlers.SysLogHandler.LOG_USER)
@@ -92,7 +92,7 @@
 format: %(message)s
 
 [formatter_long]
-format: %(asctime)s %(levelname)-7s [%(name)s] (%(threadName)s) %(message)s 
(%(module)s:%(lineno)d)
+format: %(asctime)s %(levelname)-5s [%(name)s] (%(threadName)s) %(message)s 
(%(module)s:%(lineno)d)
 
 [formatter_sysform]
 format= vdsm %(name)s %(levelname)s %(message)s
diff --git a/tests/run_tests_local.sh.in b/tests/run_tests_local.sh.in
index 121eb7c..5a8d8b6 100644
--- a/tests/run_tests_local.sh.in
+++ b/tests/run_tests_local.sh.in
@@ -5,7 +5,7 @@
 
 export \
     LC_ALL=C \
-    NOSE_LOGFORMAT='%(asctime)s %(levelname)-7s [%(name)s] (%(threadName)s) 
%(message)s (%(module)s:%(lineno)d)' \
+    NOSE_LOGFORMAT='%(asctime)s %(levelname)-5s [%(name)s] (%(threadName)s) 
%(message)s (%(module)s:%(lineno)d)' \
     NOSE_VERBOSE=${NOSE_VERBOSE:-3} \
     PYTHONDONTWRITEBYTECODE=1 \
     
PYTHONPATH="@top_srcdir@/lib:@top_srcdir@/vdsm:@top_srcdir@/client:@top_srcdir@/vdsm_api:$PYTHONPATH"
 \
diff --git a/vdsm/vdsm b/vdsm/vdsm
index 34a400c..b87fa61 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -133,6 +133,11 @@
         raise FatalError("Cannot configure logging: %s" % e)
 
     logging.addLevelName(5, 'TRACE')
+
+    # Shorten WARNING and CRITICAL to make the log align nicer.
+    logging.addLevelName(logging.WARNING, 'WARN')
+    logging.addLevelName(logging.CRITICAL, 'CRIT')
+
     logging.TRACE = 5  # impolite but helpful
     log = logging.getLogger('vds')
     try:


-- 
To view, visit https://gerrit.ovirt.org/64217
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia18649258f145f974fd4a8f7a96b5849c4a77938
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to