[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 1/2 master] Improve logging of ifcfg stuff.



On 08/23/2010 01:05 PM, Radek Vykydal wrote:
Still logging into /tmp/ifcfg.log, but now
- standard format is used,
- values of IfcfgFile are removed (only what would be written-out,
   that is __str__() output is kept) - it was only confusing,
   should be part of unit tests if anything
- logging of some events is added (e.g. Network.write(),
   Network.update())
---
  pyanaconda/gui.py     |    6 ++-
  pyanaconda/network.py |  105 ++++++++++++++++++++++++-------------------------
  2 files changed, 56 insertions(+), 55 deletions(-)


Ack, with two comments:

diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 5dc81cb..8998759 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -49,6 +49,19 @@ networkConfFile = "%s/network" % (sysconfigDir)
  ifcfgLogFile = "/tmp/ifcfg.log"
  CONNECTION_TIMEOUT = 45

+# Setup special logging for ifcfg NM interface
+from pyanaconda import anaconda_log
+logger = logging.getLogger("ifcfg")
+logger.setLevel(logging.DEBUG)
+anaconda_log.logger.addFileHandler(ifcfgLogFile, logger, logging.DEBUG)
+anaconda_log.logger.addFileHandler("/dev/tty3", logger,
+                                   anaconda_log.DEFAULT_TTY_LEVEL,
+                                   anaconda_log.TTY_FORMAT,
+                                   autoLevel=True)
+anaconda_log.logger.forwardToSyslog(logger)
+
+ifcfglog = logging.getLogger("ifcfg")
+

1) for a lack of better places to put this.. One day I'd like to move storage log init and now this log init too into anaconda_log.py.

2) if you want ifcfg messages to be correctly filed during remote logging, you need to update scripts/analog too. You can inspire yourself with how we handle "storage" there. Please either do this (the recommended option) or remove the "forwardToSyslog" call.

Ales


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]