[node-patches] Change in ovirt-node[master]: tui: swap dictConfig to fileConfig based logging for 2.6 pyc...
jboggs at redhat.com
jboggs at redhat.com
Fri May 24 03:20:47 UTC 2013
Joey Boggs has uploaded a new change for review.
Change subject: tui: swap dictConfig to fileConfig based logging for 2.6 pycompat
......................................................................
tui: swap dictConfig to fileConfig based logging for 2.6 pycompat
This swaps the config to use a file based version, there is additional work
around the temporary log file to permanent /var/log/ovirt.log to complete
in the new tui
Signed-off-by: Joey Boggs <jboggs at redhat.com>
Change-Id: Ib57350d7a6b62a75a31b59545a2552ed64013b7f
---
M Makefile.am
A conf/Makefile.am
A conf/ovirt-logging.conf
M configure.ac
M ovirt-node.spec.in
M src/ovirt/node/app.py
6 files changed, 67 insertions(+), 56 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/45/15045/1
diff --git a/Makefile.am b/Makefile.am
index e24b70e..91286c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,6 +23,7 @@
SHELL := /bin/bash
SUBDIRS = \
+ conf \
dracut \
images \
recipe \
diff --git a/conf/Makefile.am b/conf/Makefile.am
new file mode 100644
index 0000000..50fdb69
--- /dev/null
+++ b/conf/Makefile.am
@@ -0,0 +1,22 @@
+# Copyright (C) 2010 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA. A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+nodeconfdir = $(sysconfdir)/sysconfig
+
+dist_nodeconf_DATA = \
+ ovirt-logging.conf
+
diff --git a/conf/ovirt-logging.conf b/conf/ovirt-logging.conf
new file mode 100644
index 0000000..015608e
--- /dev/null
+++ b/conf/ovirt-logging.conf
@@ -0,0 +1,39 @@
+[loggers]
+keys=root,ovirt.node
+
+[handlers]
+keys=file,debug,stderr
+
+[formatters]
+keys=verbose,simple
+
+[logger_root]
+level=DEBUG
+handlers=debug,stderr
+
+[logger_ovirt.node]
+level=DEBUG
+handlers=file
+qualname=ovirt.node
+
+[handler_file]
+class=FileHandler
+level=INFO
+formatter=simple
+args=('/tmp/ovirt.log', 'w')
+
+[handler_debug]
+class=FileHandler
+level=DEBUG
+formatter=verbose
+args=('/tmp/ovirt.debug.log', 'w')
+
+[handler_stderr]
+class=StreamHandler
+level=ERROR
+args=(sys.stderr,)
+
+[formatter_verbose]
+format=F1 %(levelname)s %(asctime)s %(name)s:%(lineno)s %(message)s
+[formatter_simple]
+format=F1 %(asctime)s %(levelname)10s %(message)s
diff --git a/configure.ac b/configure.ac
index d6ef5e6..6b382ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,7 @@
AM_PATH_PYTHON
AC_CONFIG_FILES([Makefile
+ conf/Makefile
dracut/Makefile
images/Makefile
scripts/Makefile
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index 46327cc..95b7da8 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -486,7 +486,7 @@
%if ! %{is_systemd}
%{_sysconfdir}/init/libvirtd.conf
%endif
-
+%{_sysconfdir}/sysconfig/ovirt-logging.conf
%{_sysconfdir}/sysconfig/modules/vlan.modules
%{_sysconfdir}/modprobe.d/ovirt-qla4xxx.conf
%{_libexecdir}/ovirt-node/hooks
diff --git a/src/ovirt/node/app.py b/src/ovirt/node/app.py
index 811a2c5..42db9a5 100644
--- a/src/ovirt/node/app.py
+++ b/src/ovirt/node/app.py
@@ -34,65 +34,13 @@
which communicate with each other.
"""
+LOG_CONF = "/etc/sysconfig/ovirt-logging.conf"
-log_filename = "/tmp/ovirt.log"
-debug_log_filename = "/tmp/ovirt.debug.log"
-
-LOGGING = {
- 'version': 1,
- 'disable_existing_loggers': True,
- 'formatters': {
- 'verbose': {
- 'format': '%(levelname)s %(asctime)s %(name)s:%(lineno)s ' +
- '%(message)s'
- },
- 'simple': {
- 'format': '%(asctime)s %(levelname)10s %(message)s'
- },
- },
- 'handlers': {
- 'file': {
- 'level': 'INFO',
- 'class': 'logging.FileHandler',
- 'formatter': 'simple',
- 'filename': log_filename,
- },
- 'debug': {
- 'level': 'DEBUG',
- 'class': 'logging.FileHandler',
- 'formatter': 'verbose',
- 'filename': debug_log_filename,
- },
- 'stderr': {
- 'level': 'ERROR',
- 'class': 'logging.StreamHandler',
- 'stream': sys.stderr
- }
- },
- 'loggers': {
- '': {
- 'handlers': ['debug', 'stderr'],
- 'level': 'DEBUG',
- },
- 'ovirt.node': {
- 'handlers': ['file'],
- 'level': 'DEBUG',
- },
- }
-}
-
-utils.fs.truncate(log_filename)
-utils.fs.truncate(debug_log_filename)
-logging.config.dictConfig(LOGGING)
+logging.config.fileConfig(LOG_CONF)
def configure_logging():
- logdict = dict(LOGGING)
- logging.config.dictConfig(logdict)
- #logging.basicConfig(level=logging.DEBUG,
- # filename="/tmp/app.log", filemode="w",
- # format="%(asctime)s %(levelname)s %(name)s " +
-# "%(message)s")
+ logging.config.fileConfig(LOG_CONF)
class Application(base.Base):
--
To view, visit http://gerrit.ovirt.org/15045
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib57350d7a6b62a75a31b59545a2552ed64013b7f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>
More information about the node-patches
mailing list