FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 02-18-2010, 06:23 AM
Hans de Goede
 
Default logging: introduce stderr logger and use it for critical situations in kickstart.py.

Did you test this with a serial console ?

I've discussed the before with clumens and the reason to
use print is that that does the right thing wrt serial consoles.

Also notice that the cmdline.py InterfaceClass uses print in a lot
of places.

Regards,

Hans


On 02/17/2010 05:53 PM, Ales Kozumplik wrote:

---
anaconda_log.py | 6 ++++++
kickstart.py | 22 +++++++++++-----------
2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/anaconda_log.py b/anaconda_log.py
index edaf232..6ce8955 100644
--- a/anaconda_log.py
+++ b/anaconda_log.py
@@ -94,6 +94,12 @@ class AnacondaLog:
self.addFileHandler(sys.stdout, stdoutLogger,
fmtStr=STDOUT_FORMAT, minLevel=logging.INFO)

+ # Stderr logger
+ stderrLogger = logging.getLogger("anaconda.stderr")
+ stderrLogger.setLevel(logging.INFO)
+ self.addFileHandler(sys.stderr, stderrLogger,
+ fmtStr=STDOUT_FORMAT, minLevel=logging.INFO)
+
# Add a simple handler - file or stream, depending on what we're given.
def addFileHandler (self, file, addToLogger, minLevel=DEFAULT_TTY_LEVEL,
fmtStr=ENTRY_FORMAT,
diff --git a/kickstart.py b/kickstart.py
index 84434b8..26484b7 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -55,7 +55,7 @@ _ = lambda x: gettext.ldgettext("anaconda", x)

import logging
log = logging.getLogger("anaconda")
-stdoutLog = logging.getLogger("anaconda.stdout")
+stderrLog = logging.getLogger("anaconda.stderr")
from anaconda_log import logger, logLevelMap, setHandlersLevel,
DEFAULT_TTY_LEVEL

@@ -1169,16 +1169,16 @@ def preScriptPass(anaconda, file):
anaconda.intf.kickstartErrorWindow("Could not open kickstart file or included file named %s" % e.filename)
sys.exit(1)
else:
- print _("The following error was found while parsing the kickstart "
- "configuration file:

%s") % e
+ stderrLog.critical(_("The following error was found while parsing the kickstart "
+ "configuration file:

%s") % e)
sys.exit(1)
except KickstartError, e:
if anaconda.intf:
anaconda.intf.kickstartErrorWindow(e.__str__())
sys.exit(1)
else:
- print _("The following error was found while parsing the kickstart "
- "configuration file:

%s") % e
+ stderrLog.critical(_("The following error was found while parsing the kickstart "
+ "configuration file:

%s") % e)
sys.exit(1)

# run %pre scripts
@@ -1188,10 +1188,10 @@ def parseKickstart(anaconda, file):
try:
file = preprocessKickstart(file)
except KickstartError, msg:
- stdoutLog.critical(_("Error processing %%ksappend lines: %s") % msg)
+ stderrLog.critical(_("Error processing %%ksappend lines: %s") % msg)
sys.exit(1)
except Exception, e:
- stdoutLog.critical(_("Unknown error processing %%ksappend lines: %s") % e)
+ stderrLog.critical(_("Unknown error processing %%ksappend lines: %s") % e)
sys.exit(1)

handler = AnacondaKSHandler(anaconda)
@@ -1215,16 +1215,16 @@ def parseKickstart(anaconda, file):
anaconda.intf.kickstartErrorWindow("Could not open kickstart file or included file named %s" % e.filename)
sys.exit(1)
else:
- print _("The following error was found while parsing the kickstart "
- "configuration file:

%s") % e
+ stderrLog.critical(_("The following error was found while parsing the kickstart "
+ "configuration file:

%s") % e)
sys.exit(1)
except KickstartError, e:
if anaconda.intf:
anaconda.intf.kickstartErrorWindow(e.__str__())
sys.exit(1)
else:
- print _("The following error was found while parsing the kickstart "
- "configuration file:

%s") % e
+ stderrLog.critical(_("The following error was found while parsing the kickstart "
+ "configuration file:

%s") % e)
sys.exit(1)

return handler


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 02-18-2010, 07:51 AM
Ales Kozumplik
 
Default logging: introduce stderr logger and use it for critical situations in kickstart.py.

On 02/18/2010 08:23 AM, Hans de Goede wrote:

Did you test this with a serial console ?

I've discussed the before with clumens and the reason to
use print is that that does the right thing wrt serial consoles.



I tested writing stuff through the stderr logger and I can see it on
serial console.



Also notice that the cmdline.py InterfaceClass uses print in a lot
of places.


Yes and I think that's okay because we don't want to log it anyway.


Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 02-18-2010, 08:01 AM
Hans de Goede
 
Default logging: introduce stderr logger and use it for critical situations in kickstart.py.

Ok,

On 02/18/2010 09:51 AM, Ales Kozumplik wrote:

On 02/18/2010 08:23 AM, Hans de Goede wrote:

Did you test this with a serial console ?

I've discussed the before with clumens and the reason to
use print is that that does the right thing wrt serial consoles.



I tested writing stuff through the stderr logger and I can see it on
serial console.



Good, ack.


Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:41 AM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org