[tracker/tracker-1.2] libtracker-miner: Restrict the amount of data that is logged for errors
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-1.2] libtracker-miner: Restrict the amount of data that is logged for errors
- Date: Tue, 13 Jan 2015 14:42:06 +0000 (UTC)
commit f0e29525406f0eaba9b6d592826758ac253f31ce
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jan 13 14:51:50 2015 +0100
libtracker-miner: Restrict the amount of data that is logged for errors
SPARQL update strings can be very long if the entire text of a document
is being stored. Dumping these huge strings to the log eats up disk
space and makes them harder to follow.
However, often, the occurence of such an error indicates a broken
extractor. In those cases, knowing part of the SPARQL can help in
identifying the file that triggered the error.
Usually the "nie:plainTextContent" property is the last one in the
string, so we truncate the error messages at the first occurance of
this property to achieve the best of both worlds.
https://bugzilla.gnome.org/show_bug.cgi?id=735406
src/libtracker-miner/tracker-decorator.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-decorator.c b/src/libtracker-miner/tracker-decorator.c
index 28cdf4a..73380a5 100644
--- a/src/libtracker-miner/tracker-decorator.c
+++ b/src/libtracker-miner/tracker-decorator.c
@@ -19,6 +19,8 @@
#include "config.h"
+#include <string.h>
+
#include "tracker-decorator.h"
#include "tracker-decorator-internal.h"
#include "tracker-priority-queue.h"
@@ -335,9 +337,17 @@ decorator_commit_cb (GObject *object,
child_error = g_ptr_array_index (errors, i);
if (child_error) {
+ gchar *msg, *p;
+
+ msg = g_strdup (g_ptr_array_index (sparql, i));
+ p = strstr (msg, "nie:plainTextContent");
+ if (p != NULL)
+ *p = '\0';
+
g_warning ("Task %d, error: %s", i, child_error->message);
- g_warning ("Sparql update was:\n%s\n",
- (gchar *) g_ptr_array_index (sparql, i));
+ g_warning ("Sparql update was:\n%s\n", msg);
+
+ g_free (msg);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]