Author: mvidner
Date: Mon Apr 14 20:48:50 2008
New Revision: 46620
URL: http://svn.opensuse.org/viewcvs/yast?rev=46620&view=rev
Log:
If Y2DEBUGONCRASH is set, the crash handler will also print the
last few debugging log messages, even if Y2DEBUG is not set
(fate#302166).
Modified:
trunk/core/VERSION
trunk/core/liby2/src/genericfrontend.cc
trunk/core/liby2util-r/src/include/y2util/y2log.h
trunk/core/liby2util-r/src/y2log.cc
trunk/core/package/yast2-core.changes
Modified: trunk/core/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=46620&r1=46619&r2=46620&view=diff
==============================================================================
--- trunk/core/VERSION (original)
+++ trunk/core/VERSION Mon Apr 14 20:48:50 2008
@@ -1 +1 @@
-2.16.47
+2.16.48
Modified: trunk/core/liby2/src/genericfrontend.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2/src/genericfrontend.cc?rev=46620&r1=46619&r2=46620&view=diff
==============================================================================
--- trunk/core/liby2/src/genericfrontend.cc (original)
+++ trunk/core/liby2/src/genericfrontend.cc Mon Apr 14 20:48:50 2008
@@ -58,6 +58,21 @@
static bool is_ycp_value (const char* arg);
string demangle( const char * mangled );
+static
+bool
+log_blanik (const string & s)
+{
+ y2lograw (s.c_str ());
+}
+
+// fate#302166 "cache yast debugging logs in case of failure"
+static
+void log_stored_debug ()
+{
+ y2error ("Liberating suppressed debugging messages:");
+ blanik.for_each (log_blanik);
+ y2error ("End of suppressed debugging messages");
+}
// FATE 302167, info '(libc) Backtraces'
void
@@ -131,6 +146,7 @@
sig, ee.filename ().c_str (), ee.linenumber ());
y2error ("got signal %d at YCP file %s:%d",
sig, ee.filename ().c_str (), ee.linenumber ());
+ log_stored_debug ();
log_backtrace ();
// bye
signal (sig, SIG_DFL);
Modified: trunk/core/liby2util-r/src/include/y2util/y2log.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2util-r/src/include/y2util/y2log.h?rev=46620&r1=46619&r2=46620&view=diff
==============================================================================
--- trunk/core/liby2util-r/src/include/y2util/y2log.h (original)
+++ trunk/core/liby2util-r/src/include/y2util/y2log.h Mon Apr 14 20:48:50 2008
@@ -31,12 +31,21 @@
/* Logging functions */
+// Implements y2_logger
void y2_logger_function (loglevel_t level, const char *component, const char *file,
const int line, const char *func, const char *format, ...)
__attribute__ ((format (printf, 6, 7)));
+// The knights of Blanik only show up when nothing else can help, and so will
+// the messages logged here. fate#302166
+void y2_logger_blanik (loglevel_t level, const char *component, const char *file,
+ const int line, const char *func, const char *format, ...)
+ __attribute__ ((format (printf, 6, 7)));
+// Same as above, but with va_list
void y2_vlogger_function (loglevel_t level, const char *component, const char *file,
const int line, const char *func, const char *format, va_list ap);
+void y2_vlogger_blanik (loglevel_t level, const char *component, const char *file,
+ const int line, const char *func, const char *format, va_list ap);
void y2_logger_raw( const char* message );
@@ -63,12 +72,16 @@
do { \
if (should_be_logged (level, comp)) \
y2_logger_function (level,comp,file,line,function,format,##args);\
+ else if (should_be_buffered ()) \
+ y2_logger_blanik (level,comp,file,line,function,format,##args); \
} while (0)
#define y2_vlogger(level,comp,file,line,function,format,args) \
do { \
if (should_be_logged (level, comp)) \
y2_vlogger_function (level,comp,file,line,function,format,args);\
+ else if (should_be_buffered ()) \
+ y2_vlogger_blanik (level,comp,file,line,function,format,args); \
} while (0)
/*
@@ -103,8 +116,13 @@
#define y2lograw(message) y2_logger_raw(message)
/**
+ * Should we bother evaluating the arguments to the logging function?
*/
bool should_be_logged (int loglevel, string componentname);
+/**
+ * Should we bother evaluating the arguments to the buffering function?
+ */
+bool should_be_buffered ();
/**
* Set an alternate logfile name for @ref y2log. If this is not done by the
@@ -141,4 +159,23 @@
*/
bool get_log_debug();
+// stores a few strings. can append one. can return all. old are forgotten.
+class LogTail {
+public:
+ typedef string Data;
+ LogTail (size_t max_size = 42);
+ ~LogTail ();
+ void push_back (const Data &);
+
+ // consumer returns true to continue iterating
+ typedef bool (* Consumer) (const Data &);
+ void for_each (Consumer c);
+private:
+ class Impl;
+ Impl *m_impl;
+};
+
+// the instance used for last resort logging
+extern LogTail blanik;
+
#endif /* _y2log_h */
Modified: trunk/core/liby2util-r/src/y2log.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/liby2util-r/src/y2log.cc?rev=46620&r1=46619&r2=46620&view=diff
==============================================================================
--- trunk/core/liby2util-r/src/y2log.cc (original)
+++ trunk/core/liby2util-r/src/y2log.cc Mon Apr 14 20:48:50 2008
@@ -26,6 +26,7 @@
#include